Python web framework'leri (Django, Flask, FastAPI) production'da doğrudan development server ile çalıştırılmamalıdır. WSGI (Web Server Gateway Interface) veya ASGI (Async Server Gateway Interface) application server + reverse proxy mimarisi kullanılır.
Django production stack: Nginx → Gunicorn → Django. Gunicorn worker sayısı `(2 × CPU cores) + 1` formülü ile hesaplanır. `--timeout 120` uzun sorgular için; `--max-requests 1000` memory leak koruması sağlar. Static files `python manage.py collectstatic` + Nginx serve.
Flask daha hafif framework; aynı Gunicorn stack uygulanır. Blueprint yapısı büyük uygulamalarda modülerlik sağlar. Celery + Redis async task queue Flask/Django ortak pattern'idir.
FastAPI ve async Python ASGI server (Daphne, Uvicorn) gerektirir. WebSocket ve SSE desteği built-in. `--workers` ve `--worker-class uvicorn.workers.UvicornWorker` Gunicorn ile production deploy.
Virtual environment (venv) izolasyonu, pip freeze requirements.txt, ve systemd service unit ile auto-start yapılandırılır. Database migration (`python manage.py migrate`) deploy pipeline'ında otomatik çalıştırılır.
BulutX sunucular Python production deployment için Gunicorn, PostgreSQL, Redis ve Nginx stack kurulumu destekler. Python projeniz için teklif alın.
İlgili hizmet
Detayları incele