Some checks failed
Deploy Backend / deploy (push) Failing after 2m30s
- Remove flask-sse, Redis (unused) - Remove ImageService, file_utils (unused) - Remove /download-posters route (frontend handles download client-side) - Remove LETTERBOXD_API_URL, secure_filename (dead imports) - Fix duplicate TMDBService instantiation - Simplify config.py (remove REDIS_URL) - Fix gunicorn user home dir for control socket - Add .gitignore for __pycache__ - Add .gitea/workflows/deploy.yml for tag-based CI/CD
37 lines
848 B
Python
37 lines
848 B
Python
import os
|
|
from flask import Flask
|
|
from flask_cors import CORS
|
|
from src.api.routes import api_bp
|
|
from config import config
|
|
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
|
|
origins = [
|
|
"http://localhost:3000",
|
|
"http://127.0.0.1:3000"
|
|
]
|
|
frontend_url = os.environ.get("FRONTEND_URL")
|
|
if frontend_url:
|
|
origins.append(frontend_url)
|
|
CORS(app, supports_credentials=True, origins=origins)
|
|
|
|
env = os.environ.get('FLASK_ENV', 'default')
|
|
|
|
if env == "production":
|
|
app.config.update(SESSION_COOKIE_SAMESITE="None", SESSION_COOKIE_SECURE=True)
|
|
|
|
app.config.from_object(config[env])
|
|
|
|
app.register_blueprint(api_bp, url_prefix='/api')
|
|
|
|
return app
|
|
|
|
|
|
if __name__ == "__main__":
|
|
port = int(os.environ.get("PORT", 5000))
|
|
|
|
app = create_app()
|
|
app.run(host='0.0.0.0', port=port, debug=True)
|