mirror of
https://github.com/alvierahman90/uploadr.git
synced 2025-01-12 10:14:21 +00:00
Automatically create directories if non existant
This commit is contained in:
parent
3fdc435ad6
commit
ebe6398493
@ -12,8 +12,6 @@ class uploadr:
|
||||
# gunicorn
|
||||
bind = "0.0.0.0:" + uploadr.port
|
||||
```
|
||||
|
||||
You also need to create the directories `qrcodes` and `uploads` (in your working directory).
|
||||
## dependencies
|
||||
uploadr uses the following modules:
|
||||
- `flask`
|
||||
|
@ -11,6 +11,12 @@ from werkzeug.utils import secure_filename
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = os.urandom(24)
|
||||
|
||||
if not os.path.isdir(config.uploads):
|
||||
os.makedirs(config.uploads)
|
||||
|
||||
if not os.path.isdir(config.qrcodes):
|
||||
os.makedirs(config.qrcodes)
|
||||
|
||||
@app.route("/")
|
||||
@app.route('/upload', methods=['GET','POST'])
|
||||
def upload_file():
|
||||
|
Loading…
Reference in New Issue
Block a user