chainetv_web/backend/chainetv/app.py

22 lines
697 B
Python
Raw Normal View History

2019-04-29 14:23:24 +00:00
from flask import Flask,render_template
from flask_cors import CORS
2019-04-29 14:36:29 +00:00
2019-04-29 14:23:24 +00:00
#from ReverseProxied import ReverseProxied
def create_app(app_name=__name__):
2019-04-29 15:03:09 +00:00
app=Flask(__name__, static_folder= "../dist/static",template_folder="../dist")
2019-04-29 14:36:29 +00:00
app.config.from_object('chainetv.config.BaseConfig')
2019-04-29 14:23:24 +00:00
#app.wsgi_app = ReverseProxied(app.wsgi_app)
CORS(app)
2019-04-29 14:36:29 +00:00
from chainetv.api import api
2019-04-29 14:23:24 +00:00
app.register_blueprint(api, url_prefix="/api/v1")
2019-04-29 15:03:09 +00:00
@app.route('/')
2019-04-29 14:23:24 +00:00
@app.route('/<path:path>')
2019-04-29 15:05:00 +00:00
def index(path="/"):
2019-04-29 14:23:24 +00:00
return render_template('index.html')
return app
##@app.errorhandler(404)
##def ma_page_404(error):
## return redirect("https://www.ducamps.win/404/404.html", 307)