-
Notifications
You must be signed in to change notification settings - Fork 0
/
serve.py
30 lines (24 loc) · 936 Bytes
/
serve.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
from CTFd import create_app
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--port", help="Port for debug server to listen on", default=4000)
parser.add_argument(
"--profile", help="Enable flask_profiler profiling", action="store_true"
)
args = parser.parse_args()
app = create_app()
if args.profile:
from flask_debugtoolbar import DebugToolbarExtension
import flask_profiler
app.config["flask_profiler"] = {
"enabled": app.config["DEBUG"],
"storage": {"engine": "sqlite"},
"basicAuth": {"enabled": False},
}
flask_profiler.init_app(app)
app.config["DEBUG_TB_PROFILER_ENABLED"] = True
app.config["DEBUG_TB_INTERCEPT_REDIRECTS"] = False
toolbar = DebugToolbarExtension()
toolbar.init_app(app)
print(" * Flask profiling running at http://127.0.0.1:4000/flask-profiler/")
app.run(debug=True, threaded=True, host="127.0.0.1", port=args.port)