Django setup HELP!

I’ve just tried to setup and upload my Django project to dreamhost, I really need to get it uploaded ASAP.

I’ve followed the guide here :

Everything seemed to have worked fine upto the passenger_wsgi which gives me the error “An error occurred importing your” I’ve not had any experience with setting this kind of thing up before so could really use some help. My current wsgi file looks like so:

import sys, os
cwd = os.getcwd()
sys.path.append(cwd + '/projectname')

if sys.version < "2.7.5": os.execl("/home/lookeh/",
	"python2.7.5", *sys.argv)
sys.path.insert(0, '/home/<usr>/<>/evn/bin')
sys.path.insert(0, '/home/<usr>/<>/evn/lib/python2.7/site-packages/django')
sys.path.insert(0, '/home/<usr>/<>/evn/lib/python2.7/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = "projectname.settings"
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

is the shell user, and <> is my domain.

I’m really not sure where to go to fix this. I also have another query which is how to start my Django server, I’m currently doing to in Shell, using “python runserver” however if I exit Shell I assume this will quit the server also.

Any help would really be appreciated.


Is the subdirectory of your domain called “env” or “evn”? I see both in your, and one of the two is almost certainly wrong. Is this just a transcription error, or is it like that in the real thing too?

What happens if you try to run from the command line? Any errors?

It seems that you’re right! all my changes after this version I had it right but not on this one, I feel extremely stupid :frowning:

My static files however do not seem to load when debug is off, I’m not sure why this is though I’ve ran collectstatic and the files were copied to the expected location, should Django not be able to serve them from here as standard? I have the static location under home/usr/domain/static and the same location for media. Do you have any advice on what the issue could be? These locations are both set as the static_root and media_root respectively.

I’ve never used Django on a live environment before so I’m not really sure how to serve this media correctly.

Thanks for spotting my typo also, real help.

That static location isn’t right. Put static files in /home/username/ (i.e, the directory that you’ve configured as your domain root in the DreamHost Panel), and Passenger will serve them directly from there.

You’ve been really helpful, thanks a lot, if I could give you a gold star I would.