itsluckysharma01's picture
Clean deployment
4ed7d03
raw
history blame contribute delete
938 Bytes
"""
NETRA - Entry Point
Bootstraps the full application from webapp/app.py.
Run this file from the project root: python app.py
NETRA
"""
import sys
import runpy
from pathlib import Path
PROJECT_ROOT = Path(__file__).parent
sys.path.insert(0, str(PROJECT_ROOT))
if __name__ == '__main__':
import os
# Detect environment and set ports
is_hf_spaces = os.getenv('SYSTEM') == 'spaces' or os.path.exists('/.dockerenv')
if is_hf_spaces:
os.environ['PORT'] = '7860'
os.environ['FLASK_ENV'] = 'production'
os.environ['FLASK_DEBUG'] = '0'
else:
os.environ['PORT'] = os.getenv('PORT', '5001')
os.environ['FLASK_ENV'] = os.getenv('FLASK_ENV', 'development')
os.environ['FLASK_DEBUG'] = os.getenv('FLASK_DEBUG', '1')
os.environ['PYTHONUNBUFFERED'] = '1'
runpy.run_path(
str(PROJECT_ROOT / 'webapp' / 'app.py'),
run_name='__main__',
)