Automatically create directories if non existant

This commit is contained in:
alvierahman90 2017-10-25 13:26:03 +01:00
parent 3fdc435ad6
commit ebe6398493
2 changed files with 6 additions and 2 deletions

View File

@ -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`

View File

@ -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():