add basic Flask server files

This commit is contained in:
Xevion
2020-08-27 01:30:43 -05:00
commit 3e052d3692
3 changed files with 60 additions and 0 deletions

29
server/create_app.py Normal file
View File

@@ -0,0 +1,29 @@
from flask import Flask, render_template
from server.config import configs
def create_app(env = None):
app = Flask(
__name__,
static_folder="./../dist/static",
template_folder="./../dist"
)
if not env:
env = app.config['ENV']
app.config.from_object(configs[env])
@app.shell_context_processor
def shell_context():
pass
with app.app_context():
#noinspection PyUnresolvedReferences
from server import api
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
return render_template("index.html")
return app