I have two Django apps (say, app1 and app2) hosted on the same machine using Apache mod_wsgi. These two apps are hosted on two different environments:
1. On a physical server where only these two apps are hosted. They are accessed as
http://www.example.com/app1/app1/ and
http://www.example.com/app2/app2/.
2. In the second environment there is a proxy server. A separate web page on that server is accessed as
http://www.domain.com/. This links to the above two apps (now hosted on a single virtual machine) as
http://www.domain.com/id1/ and
http://www.domain.com/id2/The URLconf file looks like:
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^app1/', include('project.app1.urls')),
)
The problem is, this URL configurations works in the environment 1, but not in the environment 2. Now, if I do something *crazy* in the environment 2 such as
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^app1/app1/app1/', include('project.app1.urls')),
(r'^app1/app1/', include('project.app1.urls')),
(r'^app1/', include('project.app1.urls')),
)
then the application works. In the env. 2, the app is accessed as
http://www.domain.com/id1/app1/app1/.
I couldn't understand why we need to prefix app1 in the URL so many times. In other words, why (how) this works.
Could someone clarify on this? Also, note that all configurations need to be done on the virtual machine. I don't have access to the proxy server.
(Posted in Stackoverflow:
http://stackoverflow.com/questions/15159134/django-urls-with-without-proxy-server)