Let me first state, I'm fairly new to Python and even newer to Django, so if what I'm mentioning is already an ongoing effort, I apologize.
I was reviewing the following documentation: http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/. I has a question/possible suggestion. The documentation suggests that you should place your wsgi file in your project, which I think is a very valid location for it. My question and potential suggestion stems from the contents of the file itself. This line sort of bothers me: sys.path.append('/usr/local/django'). As well as the statement: "Remember to replace 'mysite.settings' with your correct settings file, and '/usr/local/django' with your own project's location." Doing that makes the project less portable, and requires changes from environment to environment. This is obviously not a difficult thing to accomplish, however I think the wsgi file could be made a little more generic and accomplish the task at hand. So on the surface it would appear the recommended wsgi file should look something like (obvious path variations): # Start Example From Documentation import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' sys.path.append('/usr/local/django') import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() #End Example From Documentation I think this could be simplified and made more portable for everyone with something more like the following. I intentionally used a few extra lines for readability, but it could of course be consolidated to use less variables #Start Sample of Suggested Alteration import os import sys project_folder = os.path.split(__file__)[0] project_parent_folder = os.path.split(project_folder)[0] project_name = os.path.split(project_folder)[1] sys.path.append(project_parent_folder) settings_module = project_name + ".settings" os.environ['DJANGO_SETTINGS_MODULE'] = settings_module import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() #End Sample of Suggested Alteration This version doesn't require any changes from project to project, and is independent of where the project is stored. This should lend itself to promoting projects from development into production where directory layouts may differ. I had also thought that perhaps the wsgi file could be auto-generated from the django-admin.py startproject command. I can can certainly understand if the desire is to minimize the amount of files created as part of the startproject command, however at the very least, I think updating the documentation mentioned above, would be beneficial. Again, I'm pretty new to all this stuff, so If I've missed something or what I'm suggesting is just dumb, please don't be afraid to let me know that :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.