feat: Initialize frontend with React, Vite, and Tailwind CSS
- Set up main entry point for React application. - Create About, Home, NotFound, Privacy, and Terms pages with SEO support. - Implement API service for file uploads and task management. - Add global styles using Tailwind CSS. - Create utility functions for SEO and text processing. - Configure Vite for development and production builds. - Set up Nginx configuration for serving frontend and backend. - Add scripts for cleanup of expired files and sitemap generation. - Implement deployment script for production environment.
This commit is contained in:
43
backend/app/extensions.py
Normal file
43
backend/app/extensions.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""Flask extensions initialization."""
|
||||
from celery import Celery
|
||||
from flask_cors import CORS
|
||||
from flask_limiter import Limiter
|
||||
from flask_limiter.util import get_remote_address
|
||||
from flask_talisman import Talisman
|
||||
|
||||
# Initialize extensions (will be bound to app in create_app)
|
||||
cors = CORS()
|
||||
limiter = Limiter(key_func=get_remote_address)
|
||||
talisman = Talisman()
|
||||
celery = Celery()
|
||||
|
||||
|
||||
def init_celery(app):
|
||||
"""Initialize Celery with Flask app context."""
|
||||
celery.conf.broker_url = app.config["CELERY_BROKER_URL"]
|
||||
celery.conf.result_backend = app.config["CELERY_RESULT_BACKEND"]
|
||||
celery.conf.result_expires = app.config.get("FILE_EXPIRY_SECONDS", 1800)
|
||||
celery.conf.task_serializer = "json"
|
||||
celery.conf.result_serializer = "json"
|
||||
celery.conf.accept_content = ["json"]
|
||||
celery.conf.timezone = "UTC"
|
||||
celery.conf.task_track_started = True
|
||||
|
||||
# Set task routes
|
||||
celery.conf.task_routes = {
|
||||
"app.tasks.convert_tasks.*": {"queue": "convert"},
|
||||
"app.tasks.compress_tasks.*": {"queue": "compress"},
|
||||
"app.tasks.image_tasks.*": {"queue": "image"},
|
||||
"app.tasks.video_tasks.*": {"queue": "video"},
|
||||
}
|
||||
|
||||
class ContextTask(celery.Task):
|
||||
"""Make Celery tasks work with Flask app context."""
|
||||
abstract = True
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
with app.app_context():
|
||||
return self.run(*args, **kwargs)
|
||||
|
||||
celery.Task = ContextTask
|
||||
return celery
|
||||
Reference in New Issue
Block a user