Skip to content
Snippets Groups Projects
Commit 43ea1bd2 authored by Mia Wang's avatar Mia Wang
Browse files

fixed downloading issue

parent 5e85b4f2
No related branches found
No related tags found
No related merge requests found
...@@ -22,4 +22,4 @@ deploy-job: ...@@ -22,4 +22,4 @@ deploy-job:
- pip install -r requirements.txt - pip install -r requirements.txt
- flask run & - flask run &
- echo "Now I'm Deploying to Heroku!" - echo "Now I'm Deploying to Heroku!"
- dpl --provider=heroku --app=yw21218-simplewebapp --api-key=5ccc3ae7-725e-4f9f-b441-0c9a28ebdc1b - dpl --provider=heroku --app=metarl --api-key=5ccc3ae7-725e-4f9f-b441-0c9a28ebdc1b
...@@ -2,7 +2,7 @@ import os ...@@ -2,7 +2,7 @@ import os
from flask import Flask, render_template, request, flash from flask import Flask, render_template, request, flash
from auto_augmentation import home, progress, result, download_file from auto_augmentation import home, progress,result
def create_app(test_config=None): def create_app(test_config=None):
# create and configure the app # create and configure the app
...@@ -21,6 +21,8 @@ def create_app(test_config=None): ...@@ -21,6 +21,8 @@ def create_app(test_config=None):
# ensure the instance folder exists # ensure the instance folder exists
os.makedirs(app.instance_path, exist_ok=True) os.makedirs(app.instance_path, exist_ok=True)
from auto_augmentation import download_file
app.register_blueprint(home.bp) app.register_blueprint(home.bp)
app.register_blueprint(progress.bp) app.register_blueprint(progress.bp)
app.register_blueprint(result.bp) app.register_blueprint(result.bp)
......
...@@ -3,10 +3,10 @@ from flask import Blueprint, request, render_template, flash, send_file ...@@ -3,10 +3,10 @@ from flask import Blueprint, request, render_template, flash, send_file
bp = Blueprint("download_file", __name__) bp = Blueprint("download_file", __name__)
@bp.route("/download_file", methods=["GET"]) @bp.route("/download_file", methods=["GET"])
@bp.route("/choose_file", methods=["GET", "POST"]) @bp.route("/download", methods=["GET", "POST"])
def download(): def download():
# Setup for the 'return send_file()' function call at the end of this function # Setup for the 'return send_file()' function call at the end of this function
path = 'templates/CNN.zip' # e.g. 'templates/download.markdown' path = 'templates/CNN.zip' # e.g. 'templates/download.markdown'
return send_file(path, return send_file(path,
as_attachment=True) as_attachment=True)
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
</div> </div>
<div> <div>
<form action="/download">
<input type="submit" value='Download CNN'> <input type="submit" value='Download CNN'>
</form>
</div> </div>
{% endblock %} {% endblock %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment