Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,14 +5,13 @@ from dotenv import load_dotenv
|
|
| 5 |
# Ensure environment variables are loaded
|
| 6 |
load_dotenv()
|
| 7 |
|
| 8 |
-
# Insert the backend
|
| 9 |
root_dir = os.path.dirname(os.path.abspath(__file__))
|
| 10 |
-
sys.path.insert(0, os.path.join(root_dir, 'backend_structured'))
|
| 11 |
sys.path.insert(0, os.path.join(root_dir, 'backend'))
|
| 12 |
sys.path.insert(0, root_dir)
|
| 13 |
|
| 14 |
# Import the application factory from our partitioned architecture
|
| 15 |
-
from
|
| 16 |
|
| 17 |
# Initialize the Flask application
|
| 18 |
app = create_app()
|
|
@@ -61,6 +60,6 @@ def serve_react(path):
|
|
| 61 |
|
| 62 |
|
| 63 |
if __name__ == '__main__':
|
| 64 |
-
from
|
| 65 |
port = int(os.getenv('PORT', 7860))
|
| 66 |
-
socketio.run(app, host='0.0.0.0', port=port, debug=True)
|
|
|
|
| 5 |
# Ensure environment variables are loaded
|
| 6 |
load_dotenv()
|
| 7 |
|
| 8 |
+
# Insert the backend module into python path so internal absolute imports work
|
| 9 |
root_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 10 |
sys.path.insert(0, os.path.join(root_dir, 'backend'))
|
| 11 |
sys.path.insert(0, root_dir)
|
| 12 |
|
| 13 |
# Import the application factory from our partitioned architecture
|
| 14 |
+
from backend import create_app
|
| 15 |
|
| 16 |
# Initialize the Flask application
|
| 17 |
app = create_app()
|
|
|
|
| 60 |
|
| 61 |
|
| 62 |
if __name__ == '__main__':
|
| 63 |
+
from backend.extensions import socketio
|
| 64 |
port = int(os.getenv('PORT', 7860))
|
| 65 |
+
socketio.run(app, host='0.0.0.0', port=port, debug=True, allow_unsafe_werkzeug=True)
|