-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
26 lines (19 loc) · 878 Bytes
/
run.py
File metadata and controls
26 lines (19 loc) · 878 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
#!/usr/bin/python3
import os
import platform
# Use the factory pattern instead of direct Flask instantiation
from app.factory import create_app
# Set development environment
os.environ.setdefault("FLASK_ENV", "development")
# Create app using factory pattern
# For Flask-Migrate and other CLI tools, app needs to be at module level
app = create_app()
# Only print version when actually running the server, not when imported
if __name__ == "__main__":
print("Python version " + platform.python_version())
# Use environment variables for host and port configuration
host = os.environ.get("FLASK_RUN_HOST", "0.0.0.0")
port = int(os.environ.get("FLASK_RUN_PORT", "5000"))
debug = os.environ.get("FLASK_ENV", "production") == "development"
# Temporarily disable reloader for debugging
app.run(host=host, port=port, debug=debug, use_reloader=False)