forked from ermaozi/trojan-go-panel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanage.py
34 lines (24 loc) · 764 Bytes
/
manage.py
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
28
29
30
31
32
33
34
from flask.app import Flask
from flask_cors import CORS
from main.models.exts import bcrypt, db, scheduler
from main.models.modetool import create_db
from main.urls.main import init_url
def create_app(config_path):
app = Flask(__name__,
static_folder="./web/static",
template_folder="./web")
CORS(app)
app.config.from_object(config_path)
db.init_app(app)
bcrypt.init_app(app)
with app.app_context():
create_db()
init_url(app)
scheduler.init_app(app)
scheduler.start()
return app
if __name__ == '__main__':
app = create_app("conf.flask.config.DevelopmentConfig")
app.run(host="0.0.0.0", port=8000)
else:
app = create_app("conf.flask.config.ProductionConfig")