WebFaction
Community site: login faq
0
2

Hello,

I've got my Django app all set up like this, as described in the answer.

I develop locally, and then use Fab to deploy this to the server. Locally, I use manage.py runserver, so going into the myapp directory and running that means that things like:

ROOT_URLCONF = 'myapp.urls'

Run just fine. However, when pushing that to production and running it, I get the following

ImportError at /
No module named myapp.urls

Here's the relevant line from my WSGI file:

os.environ['DJANGO_SETTINGS_MODULE'] = 'project.myapp.settings'

Is there a step I've missed? I've got an app with templatetags in it called twitter, and using {% load twitter %} in a template also produces a similar error.

asked 23 Jan '11, 06:27

Sam Starling
647
accept rate: 0%

edited 23 Jan '11, 06:28


Normally, settings reside in the root of the Django project(rather than inside apps), so references like 'myproject.settings' work just fine (assuming that settings are found inside ~/webapps/<your_app>/myproject/settings.py). If you are using your own directory structure, however, and the settings file is one level deeper, you can add the new location that Python needs to see (i.e. your "myapp" folder) to the import path.

One way of adding folders to the import Path seen by your web application is listed at http://docs.webfaction.com/software/python.html#adding-to-sys-path-from-myproject-wsgi

permanent link

answered 23 Jan '11, 06:40

tie
1.4k13
accept rate: 44%

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:

×909
×62
×27

question asked: 23 Jan '11, 06:27

question was seen: 5,170 times

last updated: 23 Jan '11, 06:40

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 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