-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
63 lines (48 loc) · 1.81 KB
/
app.py
File metadata and controls
63 lines (48 loc) · 1.81 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""
STRXplorer - Main Flask Application
Modular architecture with blueprints for better organization
"""
from flask import Flask
from config import config
from src.routes.main import main_bp
from src.routes.plots import plots_bp
from src.routes.api import api_bp
def create_app(config_name="default"):
"""
Application factory pattern
Args:
config_name: Configuration to use ('development', 'production', or 'default')
Returns:
Flask application instance
"""
app = Flask(__name__)
# Load configuration
app.config.from_object(config[config_name])
# Register blueprints
app.register_blueprint(main_bp)
app.register_blueprint(plots_bp)
app.register_blueprint(api_bp)
return app
# Create the app instance
app = create_app()
# Add this right after creating the app
import os
print(f"DEBUG: Current working directory: {os.getcwd()}")
print(f"DEBUG: Files in current directory: {os.listdir('.')}")
print(f"DEBUG: Files in data directory: {os.listdir('data') if os.path.exists('data') else 'data directory not found'}")
print(f"DEBUG: locus_data.db exists: {os.path.exists('data/locus_data.db')}")
print(f"DEBUG: manhattan_data.db exists: {os.path.exists('data/manhattan_data.db')}")
# if __name__ == "__main__":
# app.run(debug=True)
if __name__ == '__main__':
import os
# Let Render set the port, with fallback to 10000 for Render, 5000 for local
if 'RENDER' in os.environ:
# Running on Render - use their preferred port
port = int(os.environ.get('PORT', 10000))
else:
# Running locally - use 5000
port = int(os.environ.get('PORT', 5000))
print(f"Starting STRXplorer on port {port}")
print(f"Environment: {'Render' if 'RENDER' in os.environ else 'Local'}")
app.run(host='0.0.0.0', port=port, debug=False)