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