Add user authentication to index and user collections views; update CSRF trusted origins and internal IPs

This commit is contained in:
Ross
2025-12-08 10:57:38 +00:00
parent 4e47083fcd
commit d96dd77cdc
5 changed files with 298 additions and 271 deletions
+15 -1
View File
@@ -31,6 +31,8 @@ DEBUG = int(os.environ.get("DEBUG", default=0))
ALLOWED_HOSTS = [
"localhost",
"localhost:8000",
"localhost:8080",
"127.0.0.1",
"161.35.163.87",
"46.101.13.46",
@@ -241,7 +243,7 @@ MEDIA_ROOT = "media/"
LOGIN_REDIRECT_URL = "/"
LOGOUT_REDIRECT_URL = "/"
INTERNAL_IPS = ["localhost", "127.0.0.1"]
INTERNAL_IPS = ["localhost", "127.0.0.1", "localhost:8000", "localhost:8080"]
#LOGGING = {
# "version": 1,
@@ -255,6 +257,18 @@ INTERNAL_IPS = ["localhost", "127.0.0.1"]
CORS_ORIGIN_ALLOW_ALL = True
# Development: trust local origins (including ports) so the dev nginx reverse
# proxy and the Django runserver can POST/PUT without CSRF Origin errors.
if DEBUG:
CSRF_TRUSTED_ORIGINS = [
"http://localhost",
"http://127.0.0.1",
"http://localhost:8000",
"http://127.0.0.1:8000",
"http://localhost:8080",
"http://127.0.0.1:8080",
]
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",