forked from MISP/misp-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_creation.py
33 lines (27 loc) · 922 Bytes
/
app_creation.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
from app import create_app, db
from flask import render_template
import os
from app.utils.init_modules import create_modules_db
from app.utils.utils import gen_admin_password
os.environ.setdefault('FLASKENV', 'development')
app = create_app()
@app.errorhandler(404)
def error_page_not_found(e):
return render_template('404.html'), 404
def main(init_db=False, recreate_db=False, delete_db=False, create_module=False):
if init_db:
with app.app_context():
db.create_all()
elif recreate_db:
with app.app_context():
db.drop_all()
db.create_all()
elif delete_db:
with app.app_context():
db.drop_all()
elif create_module:
with app.app_context():
create_modules_db()
else:
gen_admin_password()
app.run(host=app.config.get("FLASK_URL"), port=app.config.get("FLASK_PORT") , use_reloader=False)