2021-10-07 10:39:09 +00:00
|
|
|
from flask import Flask, render_template
|
2021-10-07 11:01:22 +00:00
|
|
|
from flask_restful import Api
|
2021-05-31 13:08:10 +00:00
|
|
|
from flask_cors import CORS
|
2021-05-21 12:19:11 +00:00
|
|
|
|
2021-10-07 11:14:08 +00:00
|
|
|
from app.api.index import add_api_resources
|
2021-10-07 10:39:09 +00:00
|
|
|
from app.glob import get_config, get_manager
|
2021-05-21 12:19:11 +00:00
|
|
|
|
2021-06-15 14:04:36 +00:00
|
|
|
frontend_dir = 'frontend/dist'
|
|
|
|
app = Flask(__name__, static_url_path='/', static_folder=frontend_dir, template_folder=frontend_dir)
|
2021-05-21 12:19:11 +00:00
|
|
|
api = Api(app, '/api/v1/')
|
2021-05-31 13:08:10 +00:00
|
|
|
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
|
2021-05-21 12:19:11 +00:00
|
|
|
|
2021-10-07 11:14:08 +00:00
|
|
|
add_api_resources(api)
|
2021-05-21 12:19:11 +00:00
|
|
|
|
2021-06-15 14:04:36 +00:00
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
def index():
|
|
|
|
return index_content
|
|
|
|
|
|
|
|
|
2021-05-21 12:19:11 +00:00
|
|
|
with app.app_context():
|
|
|
|
get_config()
|
2021-09-24 13:14:59 +00:00
|
|
|
get_manager()
|
2021-06-15 14:04:36 +00:00
|
|
|
index_content = render_template("index.html")
|
2021-05-21 12:19:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run(debug=True)
|