| |
| """ |
| WSGI entry point for production deployment |
| """ |
|
|
| import os |
| import sys |
| import logging |
| from pathlib import Path |
|
|
| |
| current_dir = Path(__file__).parent |
| sys.path.insert(0, str(current_dir)) |
|
|
| |
| logging.basicConfig( |
| level=logging.INFO, |
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' |
| ) |
|
|
| |
| try: |
| from app import app |
| |
| |
| app.config['DEBUG'] = False |
| app.config['TESTING'] = False |
| |
| |
| upload_dir = app.config.get('UPLOAD_FOLDER', 'static/uploads') |
| if upload_dir.startswith('/tmp'): |
| |
| os.makedirs(upload_dir, exist_ok=True) |
| else: |
| |
| os.makedirs(upload_dir, exist_ok=True) |
| |
| logging.info("EpiPred application initialized successfully") |
| |
| except Exception as e: |
| logging.error(f"Failed to initialize application: {e}") |
| raise |
|
|
| if __name__ == "__main__": |
| port = int(os.environ.get('PORT', 5000)) |
| app.run(host='0.0.0.0', port=port) |
|
|