-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
27 lines (20 loc) · 827 Bytes
/
run.py
File metadata and controls
27 lines (20 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from flask import Flask, render_template, request, jsonify
import os
# Set the template and static folder to the client build
app = Flask(__name__, template_folder="client/build", static_folder="client/build/static")
app.config['SECRET_KEY'] = 'super secret key'
app.config['SITE'] = "http://0.0.0.0:5000/"
app.config['DEBUG'] = True
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
""" This is a catch all that is required for react-router """
return render_template('index.html')
@app.route('/test', methods=['GET'])
def login():
""" An example endpoint """
if request.method == 'GET':
return jsonify(status=200, text="Here is a test response")
if __name__ == '__main__':
port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', port=port)