40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
from flask import Flask
|
|
from flask_cors import CORS
|
|
from config import Config
|
|
from database import init_db
|
|
from routes.subscription_routes import subscription_bp
|
|
from routes.news_routes import news_bp
|
|
from routes.rss_routes import rss_bp
|
|
from routes.ollama_routes import ollama_bp
|
|
from routes.newsletter_routes import newsletter_bp
|
|
from routes.tracking_routes import tracking_bp
|
|
from routes.analytics_routes import analytics_bp
|
|
|
|
# Initialize Flask app
|
|
app = Flask(__name__)
|
|
CORS(app)
|
|
|
|
# Initialize database
|
|
init_db()
|
|
|
|
# Register blueprints
|
|
app.register_blueprint(subscription_bp)
|
|
app.register_blueprint(news_bp)
|
|
app.register_blueprint(rss_bp)
|
|
app.register_blueprint(ollama_bp)
|
|
app.register_blueprint(newsletter_bp)
|
|
app.register_blueprint(tracking_bp)
|
|
app.register_blueprint(analytics_bp)
|
|
|
|
# Health check endpoint
|
|
@app.route('/health')
|
|
def health():
|
|
return {'status': 'healthy', 'service': 'munich-news-backend'}, 200
|
|
|
|
# Print configuration
|
|
Config.print_config()
|
|
|
|
if __name__ == '__main__':
|
|
# Use 0.0.0.0 to allow Docker container access
|
|
app.run(debug=True, port=Config.FLASK_PORT, host='0.0.0.0')
|