mirror of
https://github.com/Xevion/power-math.git
synced 2025-12-06 11:15:52 -06:00
30 lines
652 B
Python
30 lines
652 B
Python
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
|