django ImportError: No module named yoursitename 8

Posted by Joel Jensen Mon, 17 Dec 2007 00:47:43 GMT

This has been frustrating me on and off for quite a while. Here’s how to fix it.

add a file called __init__.py to your folder. Done.

The error message, if you can call it that, is vague.

Basically, all python modules require this file.

Django doesn’t add one when you create a site ( an oversight in my opinion ), so you have to remember to add one. I have been doing PYTHONPATH funkiness and other hacks to get the site working without this. Now I can just relax, code and drink tea.

Trackbacks

Use the following link to trackback from your own site:
http://www.nervetree.com/trackbacks?article_id=django-importerror-no-module-named-yoursitename&day=16&month=12&year=2007

Comments

Leave a comment

  1. Fabian 8 months later:

    Thanks. That was a time saver!

  2. Matthias 10 months later:

    Thank you! I took me some time to find an error. Your hint was very valuable!

  3. conficker about 1 year later:

    That just saved me from committing sepuku.

  4. Dane Glerum about 1 year later:

    Thanks for this mate. Life saver!

  5. ruwaiting.com/paultyrrell about 1 year later:

    You are brilliant, this was really driving me nuts. I spent hrs on it.

    Thank you.

  6. gaius-julius.livejournal.com about 1 year later:

    still doesn’t work. I’ve installed the project into directory named different from project name. might that be a problem?

  7. Larimar Earrings about 1 year later:

    I’m trying to make a site that sells larimar earrings. I have a group page that lists larimar earrings, the path to the item pages is such /larimar-earrings/earring-1.html. I’m trying to import a URL file in the app folder, and I have a init.py file. It doesn’t seem to work though.

  8. prom dresses over 2 years later:

    good for you.

Comments