-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun.py
More file actions
35 lines (29 loc) · 973 Bytes
/
run.py
File metadata and controls
35 lines (29 loc) · 973 Bytes
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
35
import warnings
import signal
import sys
# Global warning suppression for CLI cleanliness
warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.filterwarnings("ignore", category=FutureWarning)
try:
from sqlalchemy.exc import SAWarning
warnings.filterwarnings("ignore", category=SAWarning)
except ImportError:
pass
try:
from flask_sqlalchemy.query import LegacyAPIWarning
warnings.filterwarnings("ignore", category=LegacyAPIWarning)
except ImportError:
pass
from app import create_app, db
from app.models import Scan, Finding, Setting
app = create_app()
@app.shell_context_processor
def make_shell_context():
return {'db': db, 'Scan': Scan, 'Finding': Finding, 'Setting': Setting}
def signal_handler(sig, frame):
print("\n[*] Server shutting down...")
sys.exit(0)
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
app.run(debug=True)