Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting stuck at Django error: No module named registration

Tags:

I installed the registration module, added it to settings.py. When I tried to run syncdb (% python sitename/manage.py syncdb --settings sitename.devsettings)

It gave me "Error: No module named registration"

The same setup works (using the same files for everything) fine on the server. This happens on my local machine running OS X.

I checked the sys.path, the path where registration module resides is listed, and the actual module is in place as well. Since there is not much else being outputted, I am not sure how to debug further. What could be causing this problem?

like image 404
Boon Avatar asked Jun 08 '09 16:06

Boon


2 Answers

Since this page ranks nicely in Google, it seems like a good place for a general answer that might help. Sometimes the folder name in svn/git is different than the folder name in settings.py -- a trap for the unwary.

So, if INSTALLED_APPS references your stuff as mywhatever.someapp then it is likely you want settings.py to be in the "mywhatever" folder, with a subfolder "someapp" that contains an __init__.py file.

like image 95
Scott Lawton Avatar answered Sep 21 '22 11:09

Scott Lawton


You mention sys.path so you might have tried this, however this was my problem and I'm sure some people reading this have it too.

open the command prompt and enter (with the trailing slash):

export PYTHONPATH=pathto/myproject/ 

then enter:

export DJANGO_SETTINGS_MODULE=settings 

This allows me to edit the settings.py file to list the INSTALLED_APPS like this:

INSTALLED_APPS = (     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.sites',     'myapp',     'registration',  ) 

instead of:

INSTALLED_APPS = (     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.sites',     'myproject.myapp',     'myproject.registration', ) 
like image 24
saranicole Avatar answered Sep 18 '22 11:09

saranicole