development purposes instead of the built in server that you have to
fire up using the shell command, manage.py runserver every time you
need it. On a Windows 7 machine, I followed the instructions to set
up my apache server with django here: https://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
but I still had plenty of trouble getting it to work propertly. For
example, I kept getting import errors in the log files such as, "no
module name project.urls" in my wsgi script. Also, apache didn't serve
my static files at all. I'm using django version (1, 4, 0, 'alpha', 0)
In case anybody is having trouble with this setup, here is a blog that
helped me get it working properly:
http://pradyumnajoshi.wordpress.com/2009/06/09/setting-up-mod_wsgi-for-apache-and-django-on-windows/
This blog provides simple, detailed instructions on how to set up your
apache httpd configuration file, where to download and copy your
mod_wsgi file, etc.
In addition, in my django.wsgi file, located in project/apache/
directory, I use the following:
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
I found the above at stackoverflow:
http://stackoverflow.com/questions/5841531/django-mod-wsgi-apache-importerror-at-no-module-named-djproj-urls
Note the above differs slightly from the official docs. Now it all
seems to work properly. I got import errors when I simply used
sys.path.append(path), where path was the absolute path to my project,
instead of lines 4&5 above. Hope this helps someone who might be
having trouble like I did.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment