login community faq

Hi,

I'm trying to deploy my django app which is working locally. However, I'm getting an internal server error in my webfaction deployment. I'm thinking this is a pythonpath problem since I don't get this error on my local installation?

This is what I get in my django log:

1
2
3
4
 File ".../django/lib/python2.6/django/utils/importlib.py", line 35, in import_module
 File ".../django/mydjangoapp/tagging/__init__.py", line 3, in <module>
from tagging.managers import ModelTaggedItemManager, TagDescriptor
TemplateSyntaxError: Caught ImportError while rendering: No module named tagging.managers

It seems that there is a problem with the "tagging" app. The tagging app is in my django folder though, and it includes managers.py.

I'm thinking this might be a pythonpath problem since the app works locally? How should I change my pythonpath to add the apps that are inside my django/mydjangoapp folder?

Thanks for any help.

asked Dec 29 '10 at 14:55

Rrr8's gravatar image

Rrr8
1614


The problem was that my project wasn't in my pythonpath. I had to add it myself.

There are several ways to do this. You can read about all of the different ways here: http://docs.webfaction.com/software/python.html#importerror

What I did was add the path to my app into the "myproject.wsgi" file:

Open /home/username/webapps/djangoapp/myproject/myproject.wsgi If there is no line such as

1
sys.path = ['/home/username/webapps/djangoapp/myproject'] + sys.path

Add it in there.

You can add more paths of course as well, check out the documentation link for more info.

answered Jan 05 '11 at 04:22

Rrr8's gravatar image

Rrr8
1614

Try the following:

1
from myproject.tagging.managers import ModelTaggedItemManager, TagDescriptor

Replace myproject with the name of your django project. If that doesn't fix it, feel free to open a support ticket and we can take a look at your application.

answered Dec 29 '10 at 14:58

aaronh's gravatar image

aaronh ♦♦
12743

Hi, thank you for the fast reply. I tried this, but now it's giving the same error for "tagging.models". So it seems the "tagging" app doesn't work at all. I'll try to figure it out and open a support ticket if I can't get it working.

(Dec 29 '10 at 15:11) Rrr8 Rrr8's gravatar image

You might need to put myproject before tagging every time you import it. If you can't get it working, we'll be happy to help you if you open a support ticket.

(Dec 29 '10 at 15:47) aaronh ♦♦ aaronh's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
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

Tags:

×653
×73
×63
×12

Asked: Dec 29 '10 at 14:55

Seen: 1,807 times

Last updated: Jan 05 '11 at 04:22

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited