WebFaction
Community site: login faq

Hi, I had a heck of a time tracking down the cause of this error:

TemplateSyntaxError: Caught ImportError while rendering: No module named myApp

I found some relevant stuff here:

http://forum.webfaction.com/viewtopic.php?id=1875

but it took me a while to figure out that I needed to fully qualify my app's name (as in project.myapp) throughout my project

The forum post above suggested that an overly permissive PYTHONPATH is the culprit. However, on my macosx system, I don't have a PYTHONPATH environment variable. I'd like to know how to recreate the conditions on my home system that better reflect the webfaction environment. Specifically how do I make my app break at home the same way it was breaking on webfaction?

Thanks!

asked 21 Nov '10, 05:28

ColeVsCode's gravatar image

ColeVsCode
1111
accept rate: 0%


The PYTHONPATH is not always defined in an environment variable. It can also be edited directly in code by editing sys.path (as you most likely know).

Your local development environment probably already has your project in your PYTHONPATH. Rather than breaking your local environment, you'd be better off fixing your production environment.

In your httpd.conf (or your WSGI file) make sure that the path to your project is in your WSGIPythonPath line. For example:

WSGIPythonPath /home/username/webapps/app/my_project:/home/username/webapps/my_app/lib/python2.6

Now you'll be able to just say myapp in place of project.myapp.

permanent link

answered 21 Nov '10, 05:37

David%20L's gravatar image

David L ♦♦
1.4k13
accept rate: 45%

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:

×842

question asked: 21 Nov '10, 05:28

question was seen: 11,196 times

last updated: 21 Nov '10, 05:37

O
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
SUITE 1, FIRST FLOOR, 41 CHALTON STREET, LONDON NW1 1JD, UNITED KINGDOM