os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
/home/user/git/project/app/views.py
def main(request):
return render(request, "appname/template.tmpl")
def testme(request):
return render(request, "appname/template2.tmpl")
/home/user/git/project/app/urls.py
urlpatterns = [
url(r'^$', "app.views.main", name="app-main"),
url(r'^testme/$', "app.views.testme", name="app-testme"),
]
/home/user/git/project/app/templates/app/template.tmpl
...HTML Stuff...
<a href="{% url "app-testme" %}>testme</a>
...More HTML stuff
--------------
The above app works 100% fine when I go to http://site.internal/wsgi-app/. If I hover over the "testme" anchor, I get http://site.internal/wsgi-app/testme/
BUT! If I go to http://site.internal/non-good-html.html and get redirected by the ErrorDocument 404 directive it shows my views.main() page.
When I hover over the "testme" anchor, I get http://site.internal/testme/ (***Notice the missing /wsgi-app/***)
It seems like the app namespace is not preserved when I'm rendering the main() page from an ErrorDocument directive.
I tried adding app_name="wsgi-app" to the urls.py but it doesn't change anything.
I must be missing something simple as this seems like an easy use-case to implement.
Pat