WebFaction
Community site: login faq

I created a django site on my laptop and after debugging it locally scp'ed it onto the webfaction server. I just did what the tutorial said and removed the myproject folder and switched a few variables to my page. It now cannot find the module that is inside my site and I have no idea why, I still have it included under the settings applications and it worked fine on my computer. Does django on webfaction do something different with storing modules?

asked 12 May '11, 15:17

Chelsea Bingiel
1111
accept rate: 0%


Django is just a Python module, and all other modules it needs (including pieces of your Django application) need to be on the Python Path for that to work.

The easiest way to solve this problem is to add the path to your Django project into the python path (sys.path) within your WSGI file, as shown here:

http://docs.webfaction.com/software/python.html#adding-to-sys-path-from-myproject-wsgi

For example, if your django webapp is named "djangoapp" and your django project is named "my_django_proj", then you would:

  1. Open ~/webapps/djangoapp/my_django_proj.wsgi (or myproject.wsgi if you are using the template)
  2. Add the following line near the top:

    sys.path = '/home/username/webapps/djangoapp/my_django_proj' + sys.path

    (where "username" is your username)

The documentation page also gives the example of adding another directory to the pythonpath as well (to demonstrate the list functionality) but in your case this single line should be sufficient.

Hope that helps!

permanent link

answered 12 May '11, 19:36

ryans ♦♦
5.0k73159
accept rate: 43%

edited 12 May '11, 19:37

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×901
×108
×97
×19
×15

question asked: 12 May '11, 15:17

question was seen: 10,749 times

last updated: 12 May '11, 19:37

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM