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
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aa74d449-18e7-43d5-9b5a-10d38239c1a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment