Hi, I’ve already searched a lot and tried a lot of things, but did not came up with a solution yet.
When accessing my development environment via localhost/127.0.0.1 everything works fine, standard django admin login, and all my forms, but when I access via my host IP I get the 403 Forbidden with every Form POST.
settings.py
import os
import environ
from pathlib import Path
# Set the project base directory
BASE_DIR = Path(__file__).resolve().parent.parent
env = environ.Env(
DEBUG=(bool, False)
)
# Take environment variables from .env file
environ.Env.read_env(os.path.join(BASE_DIR, '.env'))
#Environ
SECRET_KEY = env('SECRET_KEY')
DEBUG = env('DEBUG')
ALLOWED_HOSTS = env('ALLOWED_HOSTS').split(' ')
SECURE_HSTS_SECONDS = env('SECURE_HSTS_SECONDS')
SECURE_HSTS_INCLUDE_SUBDOMAINS = env('SECURE_HSTS_INCLUDE_SUBDOMAINS')
SECURE_HSTS_PRELOAD = env('SECURE_HSTS_PRELOAD')
CSRF_COOKIE_SECURE = env('CSRF_COOKIE_SECURE')
SESSION_COOKIE_SECURE = env('SESSION_COOKIE_SECURE')
CSRF_TRUSTED_ORIGINS = ['http://*', 'https://*']
ALLOWED_ORIGINS = CSRF_TRUSTED_ORIGINS.copy()
urls.py
urlpatterns += [
path('accounts/', include('django.contrib.auth.urls')),
path('', TemplateView.as_view(template_name='home.html'), name='home'),
path('registro/', include('registro.urls'), name='registro'),
]
.env I’m using exclusively on my development environment:
export DEBUG=True
export ALLOWED_HOSTS='*'
export SECURE_HSTS_SECONDS=15780000
export SECURE_SSL_REDIRECT=False
export SECURE_HSTS_INCLUDE_SUBDOMAINS=False
export SECURE_HSTS_PRELOAD=False
export CSRF_COOKIE_SECURE=False
export SESSION_COOKIE_SECURE=False
But I’ve already tried, with no sucess, to test obeying to all ./manage.py check --deploy requirements
Extra info: currently running manage.py runserver 0.0.0.0:8080
Also tried running via uvicorn, uvicorn+nginx, nothing worked so far.
Thanks in advance.