Re: Same application with different URLs
One more note, just if somebody else runs into this. Apparently, the problem with this solution is that under certain conditions, SetEnv from one virtual host can be visible inside the Python interpreter associated with another virtual host. Since mod_python suggests not to use SetEnv, one should probably not be surprised all that much. A working solution is to branch on something else than the environment variable in urls.py. Using apache.interpreter imported from mod_python seems to work just fine. Petr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Same application with different URLs
Hi Andrew, > What is the error 500? Is it the same error every time? I did not find any details in the logs and with DEBUG = True, the site starts behaving correctly. > Also, you have restarted apache? Different apache processes could be > out of sync and running different django configs, thus giving > different outcomes. Yes, to no avail. After half a day of experimenting, it looks like using the transactional middleware to make a separate transaction for every request was what was needed (still testing to make sure everything works, but I did not see the error for some time now. Thanks, Petr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Same application with different URLs
Hello, I have a Django application that I need to appear on multiple Apache virtual hosts with different URLs (e.g. the same view would be accessible under http://one.site/view and under http://another.site/another/path/to/view). So far, I have tried to have multiple interpreter instances under mod_python, give each instance a different environment setting via SetEnv, and branch in urls.py like this: ServerName "one.site" SetEnv DJANGO_URL_SITE_ONE ... ... ServerName "another.site" SetEnv DJANGO_URL_SITE_TWO ... ... urls.py: if "DJANGO_URL_SITE_ONE" in os.environ: urlpatterns = ... # Patterns for one.site if "DJANGO_URL_SITE_TWO" in os.environ: urlpatterns = ... # Patterns for another.site The approach seems to work somewhat (both sites are visible on the appropriate URLs), but after doing this, the application itself became strangely unreliable. When both sites are used, an Error 500: Internal server error is frequently returned (but mere repeated reloading of the same page eventually gives a correct page). Before I go off on hunting the bug somewhere in the application (which used to work fine before), my question is: is this approach (that is, having multiple interpreters running multiple instances of the same application from the same directories, accessing the same database) something that should work ? Thanks, Petr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---