Sunday, April 22, 2012

Django nginx uWSGI

Hi, I am attempting to get nginx and uwsgi running on my local box, I followed any number of tutorials and this one had the most complete information. 
http://gekicstart.ca/tech-posts/nginxuwsgidjango-stack/

It is written for Debian\Ubuntu so I had to transpose a bit. I got through most of it and I got to the section on creating the daemon for uwsgi that loads a specific project. It creates a /etc/init/projectX.conf file that it loads the uwsgi specific information from. I didn't know enough to create a daemon in arch so I opted for running the command by cli.

 /usr/bin/uwsgi socket /root/Workspace/Eclipse/sockets/projectX.sock --chmod-socket --module wsgi_app --pythonpath /root/Workspace/Eclipse/projectX/uwsgi -p 1

I also extended the relative paths to absolute from the example code, so far so good. but when it loads the below file.

when I run this it craps on the django import

 #!/usr/bin/python2.7 import sys import os import django.core.handlers.wsgi sys.path.append("/Eclipse/") os.environ['DJANGO_SETTINGS_MODULE'] = 'projectX.settings' application = django.core.handlers.wsgi.WSGIHandler()

It can't find django, I tested by reducing the statement

 import django.core.handlers.wsgi

section by section, in other words I tested 'import django.core.handlers', 'import django.core' etc. each time it couldn't find the reference, I know that django is loaded in python2.7/site-packages.

Further I also opened up a python2.7 prompt and used the same import statement successfully. I tried changing the declaration for the python script to
 #!/usr/bin/python #!/usr/bin/python2 #!/usr/bin/python2.7

None has solved the problem. Does anyone have an idea why it can't see django? The python prompt sees it no problem.

thanks in advance for your help.

--jerry


Gerald Klein DBA

ContactMe@geraldklein.com

www.geraldklein.com

jk@zognet.com

708-599-0352


Linux registered user #548580 



--
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