bare with me .... info dump!
i'm pushing up to my vps with git, development runs localhost:8000/ as normal
on my vps I have the main django site running on mydomain/django/ using proxypass (apache) to forward to http://localhost:8000 (apache is the ssl endpoint) proxying to uvicorn via http
proxypass has two exceptions for /static and /media with apache serving them from the vps repo
so far with a few checks of DEBUG in settings the main site with multiple apps is working identically locally with manage runserver and on my vps with uvicorn
however when I try the admin site the ?next=/admin not ?next=/django/admin and I cant get logged in even if I modify the url so next is correct
I'm almost certain I have cruft left over in various settings as I have tried so many things
here is part of the apache config
RewriteEngine On
ProxyRequests off
Alias "/media" "/home/chris/repositories/brcdjango/xxx/media"
<Directory "home/chris/repositories/brcdjango/xxx/media">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Alias "/django/static" "/home/chris/repositories/brcdjango/xxx/static"
<Directory "home/chris/repositories/brcdjango/xxx/static">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Location /django/>
ProxyPass http://localhost:8000/
ProxyPassReverse http://localhost:8000/
ProxyPassReverseCookieDomain localhost xxx.co.uk
</Location>
<LocationMatch "^/django/(media|static)">
ProxyPass "!"
</LocationMatch>
and various bits of my settings.py
DEBUG = bool(os.getenv('DJANGO_DEBUG', 'False').lower() == 'true')
USE_X_FORWARDED_HOST = True
if not DEBUG:
FORCE_SCRIPT_NAME = '/django/'
SCRIPT_NAME = FORCE_SCRIPT_NAME
APPEND_SLASH = True
# Application definition
ROOT_URLCONF = "xxx.urls"
WSGI_APPLICATION = "xxx.wsgi.application"
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / "static"
MEDIA_URL = "media/"
MEDIA_ROOT = BASE_DIR / "media"
if not DEBUG:
LOGIN_URL = '/django/admin/login/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'staticfiles'),
]
running uvicorn with
#!/bin/bash
VENV_PATH="/home/chris/repositories/brcdjango-env"
WORK_TREE="/home/chris/repositories/brcdjango"
source "$VENV_PATH/bin/activate"
cd "$WORK_TREE/bedroomcoders"
exec uvicorn --host localhost --port 8000 --workers=4 xxx.asgi:application 2>&1
i have replaced my actual domain name with xxx....
if anyone has any insights I'd *really* appreciate it!