Fix: Add requests to requirements and update settings/urls for deployment

This commit is contained in:
Flatlogic Bot 2026-01-28 16:18:03 +00:00
parent 131b7284cc
commit d8d794fe04
3 changed files with 8 additions and 10 deletions

View File

@ -20,13 +20,8 @@ load_dotenv(BASE_DIR.parent / ".env")
SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", "change-me") SECRET_KEY = os.getenv("DJANGO_SECRET_KEY", "change-me")
DEBUG = os.getenv("DJANGO_DEBUG", "true").lower() == "true" DEBUG = os.getenv("DJANGO_DEBUG", "true").lower() == "true"
ALLOWED_HOSTS = [ # Allow all hosts to avoid 404/400 errors during initial deployment
"127.0.0.1", ALLOWED_HOSTS = ["*"]
"localhost",
os.getenv("HOST_FQDN", ""),
".sslip.io",
".coolify.io",
]
CSRF_TRUSTED_ORIGINS = [ CSRF_TRUSTED_ORIGINS = [
origin for origin in [ origin for origin in [
@ -38,8 +33,8 @@ CSRF_TRUSTED_ORIGINS = [
f"https://{host}" if not host.startswith(("http://", "https://")) else host f"https://{host}" if not host.startswith(("http://", "https://")) else host
for host in CSRF_TRUSTED_ORIGINS for host in CSRF_TRUSTED_ORIGINS
] ]
# Also allow sslip/coolify for CSRF if needed (wildcards not supported in CSRF_TRUSTED_ORIGINS, requires exact match) # Add the current sslip domain if known, or rely on wildcard matching (Django 4.0+ requires explicit trusted origins for CSRF)
# Users must set HOST_FQDN or CSRF_TRUSTED_ORIGIN for POST requests to work on these domains. # For now, we rely on the user setting HOST_FQDN correctly.
# Cookies must always be HTTPS-only; SameSite=Lax keeps CSRF working behind the proxy. # Cookies must always be HTTPS-only; SameSite=Lax keeps CSRF working behind the proxy.
SESSION_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True

View File

@ -3,6 +3,7 @@ from django.urls import path, include
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
from django.conf.urls.i18n import i18n_patterns from django.conf.urls.i18n import i18n_patterns
from django.http import HttpResponse
from rest_framework import permissions from rest_framework import permissions
from drf_yasg.views import get_schema_view from drf_yasg.views import get_schema_view
@ -22,6 +23,7 @@ schema_view = get_schema_view(
) )
urlpatterns = [ urlpatterns = [
path('health/', lambda request: HttpResponse("OK")), # Simple health check
path('i18n/', include('django.conf.urls.i18n')), path('i18n/', include('django.conf.urls.i18n')),
# Swagger / Redoc # Swagger / Redoc
path('swagger<format>/', schema_view.without_ui(cache_timeout=0), name='schema-json'), path('swagger<format>/', schema_view.without_ui(cache_timeout=0), name='schema-json'),

View File

@ -9,4 +9,5 @@ djangorestframework==3.15.1
drf-yasg drf-yasg
gunicorn==22.0.0 gunicorn==22.0.0
django-cors-headers django-cors-headers
django-admin-rangefilter django-admin-rangefilter
requests