Created
January 17, 2018 20:08
-
-
Save jvsoest/b9da65347369163b5bde6dbcc2aab91c to your computer and use it in GitHub Desktop.
Python image service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, request, url_for | |
import os | |
if not os.path.exists("static"): | |
os.makedirs("static") | |
app = Flask('ImageShow', template_folder='') | |
@app.route('/', methods=['GET', 'POST']) | |
def index(): | |
if request.method == "GET": | |
return render_template("./index.html") | |
if request.method == "POST": | |
file = request.files['file'] | |
file.save("static/image.png") | |
return render_template("./index.html") | |
app.run(debug=True, host='0.0.0.0', port=5000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment