Skip to content

Instantly share code, notes, and snippets.

@jvsoest
Created January 17, 2018 20:08
Show Gist options
  • Save jvsoest/b9da65347369163b5bde6dbcc2aab91c to your computer and use it in GitHub Desktop.
Save jvsoest/b9da65347369163b5bde6dbcc2aab91c to your computer and use it in GitHub Desktop.
Python image service
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