I've a Django website running under IIS with a help of Helicon Zoo. It is located in virtual directory (so, url to it looks like http://mysite.com/django
).
In my urls.py, I have patterns defined like this:
urlpatterns = patterns('',
....
url(r'^django/status/(?P<product>.*)/$',views.status),
....
)
But, when I open url like http://mysite.com/django/status/some_product
I'm getting 404 page with message:
Using the URLconf defined in urls, Django tried these URL patterns, in this order:
....
The current URL, status/some_product/, didn't match any of these.
As you can see, there is no django in URL which is tested. And of course, when I change pattern like this:
url(r'^status/(?P<product>.*)/$',views.status),
Everything works fine, but if APPEND_SLASH
is enabled (and I have it enabled and setting it to False
in settings.py does not help for some reason), my requests like http://mysite.com/django/status/some_product
are redirected to http://mysite.com/status/some_product/
.
So, the question is: How can I configure Django so it will not throw out virtual directory name?
Is there anything I need to know about how to turn of APPEND_SLASH?
Right now I simply put APPEND_SLASH = False
in settings.py, but no difference.
Note: I know almost nothing about Django and Python and I can't change how that website is set up (at least now).
Finally, I've found what's wrong with it.
Appeared that the reason for described behavior is a setting provided with default web.config file:
<add name="django.root" value="%APPL_VIRTUAL_PATH%" />
After I removed it everything started working fine.
Here is some info related to django.root
variable applied to Apache.