diff --git a/app.py b/app.py index 090a609..1882e64 100644 --- a/app.py +++ b/app.py @@ -5,18 +5,21 @@ app = Flask(__name__) UPLOAD_FOLDER = "uploads" -BUCKET = "lats-image-data" +BUCKET = os.environ.get('BUCKET_NAME') + @app.route("/") def home(): contents = list_files(BUCKET) - return render_template('index.html') + return render_template('index.html', bucket_name=BUCKET) + @app.route("/pics") def list(): contents = show_image(BUCKET) return render_template('collection.html', contents=contents) + @app.route("/upload", methods=['POST']) def upload(): if request.method == "POST": @@ -25,6 +28,6 @@ def upload(): upload_file(f"uploads/{f.filename}", BUCKET) return redirect("/") + if __name__ == '__main__': app.run(debug=True) - \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 5bdbbb9..5898db8 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,9 +4,10 @@