mirror of
https://github.com/ilri/csv-metadata-quality-web.git
synced 2024-11-30 02:18:20 +01:00
main.py: Try to upload to /tmp
Creating and uploading to an "uploads" directory works locally, but on Google App Engine I get an HTTP 500. Let's try uploading to /tmp.
This commit is contained in:
parent
b3e66e1a8f
commit
d204c23b93
8
main.py
8
main.py
@ -6,7 +6,7 @@ from werkzeug.utils import secure_filename
|
|||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config["MAX_CONTENT_LENGTH"] = 1024 * 1024
|
app.config["MAX_CONTENT_LENGTH"] = 1024 * 1024
|
||||||
app.config["UPLOAD_EXTENSIONS"] = [".csv"]
|
app.config["UPLOAD_EXTENSIONS"] = [".csv"]
|
||||||
app.config["UPLOAD_PATH"] = "uploads"
|
app.config["UPLOAD_PATH"] = "/tmp"
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
@ -24,12 +24,6 @@ def upload_file():
|
|||||||
if file_ext not in app.config["UPLOAD_EXTENSIONS"]:
|
if file_ext not in app.config["UPLOAD_EXTENSIONS"]:
|
||||||
abort(400)
|
abort(400)
|
||||||
|
|
||||||
# make sure the upload directory exists
|
|
||||||
try:
|
|
||||||
os.mkdir(app.config["UPLOAD_PATH"])
|
|
||||||
except FileExistsError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
uploaded_file.save(os.path.join(app.config["UPLOAD_PATH"], filename))
|
uploaded_file.save(os.path.join(app.config["UPLOAD_PATH"], filename))
|
||||||
|
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
|
Loading…
Reference in New Issue
Block a user