Django prefix on all generated URLs
django-admin
Solution
See documentation for FORCE_SCRIPT_NAME:
https://docs.djangoproject.com/en/dev/ref/settings/#force-script-name
Set that to be '/app' instead of default of None.
Problem
My proxy (nginx public port 80) to django (gunicorn wsgi localhost port 8000) strips off the path to the application "/app" so requests for `http://server/app/hello` appears to django as `/hello` and requests for `http://server/app/admin` appears to django as `/admin`. The problem is that the admin site generates output with absolute URLs such as `<form action="/admin/"...` in the login screen. So the user sees the admin login screen but it posts to `http://server/admin` which doesn't exist. (I kind of hoped it would use relative URLs and work at any location.) What is the simplest way to get the admin pages to universally prepend "/app" like `form action="/app/admin/"` to all URLs it generates in page output? I am hoping for something built into Django like a simple define, and not having to create special filters then rewrite templates to use them, but I can't seem to find it.