-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwsgi.py
More file actions
40 lines (32 loc) · 1.21 KB
/
wsgi.py
File metadata and controls
40 lines (32 loc) · 1.21 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
"""
WSGI Entry Point for Production Deployment
This file creates the Flask application instance that will be used by
gunicorn or other WSGI servers.
"""
import os
from topic_modeling_script import create_app
# Find the dataset file
base_path = os.path.dirname(os.path.abspath(__file__))
possible_paths = [
os.path.join(base_path, 'dataset.csv'),
os.path.join(base_path, 'moederbestek', 'dataset_MAR2025_FR.csv'),
os.path.join(base_path, 'moederbestek', 'specifications_catalog_full.csv'),
os.path.join(base_path, 'specifications_catalog_full_NL.csv'),
os.path.join(base_path, 'specifications_catalog_full_FR.csv')
]
dataset_path = None
for path in possible_paths:
if os.path.exists(path):
dataset_path = path
print(f"Using dataset: {path}")
break
if not dataset_path:
# Default to first path, will be created if needed
dataset_path = possible_paths[0]
print(f"Warning: No existing dataset found, will attempt to use: {dataset_path}")
# Create the Flask application
app = create_app(dataset_path)
# This allows the app to be run directly for testing
if __name__ == "__main__":
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', debug=False, port=port)