Main.py
======================================================================
from flask import Flask, request, render_template
# Imports the Google Cloud client library
# If `entrypoint` is not defined in app.yaml, App Engine will look for an app
# called `app` in `main.py`.
app = Flask(__name__)
@app.route('/', methods=['POST','GET']) # This defines when the function below will be called
def run_quickstart():
if request.method == 'POST':
data = request.form.to_dict(flat=True)
Comments = data['mycomments'] # Sends data to the form
return render_template('comments.html', FormComments=Comments) # Renders the page with the response
else:
# This code will run if a GET is received
return render_template('index.html')
if __name__ == "__main__":
# This is used when running locally only. When deploying to Google App
# Engine, a webserver process such as Gunicorn will serve the app. This
# can be configured by adding an `entrypoint` to app.yaml.
app.run(host="127.0.0.1", port=8080, debug=True)
===============================================================
requirements.txt
===============================================================
No comments:
Post a Comment