Reputation: 41510
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?
Upvotes: 24
Views: 90106
Reputation: 1
I had the same/similar error. and this was my installed apps setting in the settings.py.
INSTALLED_APPS = [
...,
'app_name',
]
However, this application folder was located inside the project folder, moving it to the same level as the project folder cleared the error.
I hope that helps.
Upvotes: 0
Reputation: 1617
I had the same issue, was following old course, it creates a folder that has '-' in its name and puts all the modules in it.
the name was like "portfolio-project" but I change it to "portfolio_project", solved the problem with importing
import portfolio_project.jobs.views
not
import jobs.views
Upvotes: 0
Reputation: 73
I ran into this problem because I was messing up with my virtualenv.
I had two windows open:
I had successfully installed the Django-registration package into my venv on my Windows computer:
$ . venv/Scripts/activate
$ pip install Django-registration-redux==2.0
But my server was not in the venv, so it could not find the package.
Stopped the server, entered venv in that window, then restarted the server and all is good.
Upvotes: -1
Reputation: 51
When I've installed django-registration to my virtual env, I've had the same error. Don't know how it worked exactly, but when I've installed this lib to the main Python directory (not virtual env) the error has disappeared.
Maybe It will help to someone.
Upvotes: 0
Reputation: 39
I've faced this problem until a figured out that the enviroment was not activated.
Check if your Virtualenv is activated. If not, run in the shell
source .<enviroment name>/bin/activate
Upvotes: 2
Reputation: 51
Fixed! I had the same problem, I was trying to register submodules, like:
project
organization
categories
In my settings file I added
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> ...
> 'organization.categories', )
When you generate a module in the folder categories you have a init.pyc I copied this file into "organization" folder, then I execute the following commands:
sudo python manage.py makemigrations
sudo ./manage.py syncdb
And it works file!
Upvotes: 5
Reputation: 1106
If this happens to you on Windows and while using virtualenv, it's possibly because of virtualenv.
Install that package on the local (non virtualenv) environment and it should work.
I had the same problem with django-crispy-forms.
Upvotes: 0
Reputation: 35
I had this on SX with virtualenv too, after installing with PIP as per the docs. I did another install using easy_install and after that, it all worked.
easy_install -Z django-registration
Upvotes: 2
Reputation: 596
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.
Upvotes: 30
Reputation: 420
I had this problem. I had saved the app in the project folder (as in, the same folder as manage.py), but referenced to "projectname.appname" instead of just "appname" in INSTALLED_APPS in settings.py.
Upvotes: 4
Reputation: 121
I was simply missing a comma after the 'registration' entry in the settings.py file. Once I added the comma after 'registration', Syncdb worked for me.
Upvotes: 12
Reputation: 2483
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',
)
Upvotes: 15
Reputation: 81
Make sure you have an entry in installed_apps, And you have the minimum 4 files in your apps. init.py, urls.py, models.py, and views.py
Upvotes: 1
Reputation: 1266
Just try this
1) Put down the registration app inside your project as an app
and do the syncdb
do the below for finding out the exact cause of error
1.go to you project directory
2.python manage.py dbshell
3.in shell
4.import registration
5.if you get error here which means your registration module is not
there on the python path (or) some problem in finding that one.
if it works then some other problem like improper compilation .............
Upvotes: 0
Reputation: 3533
There may be Python errors in your registration
models. Try starting a shell and importing them, instantiating them, etc.
Upvotes: 9
Reputation: 87185
My first guess would be you haven't added 'registration'
into installed apps
in the settings.py
file.
Perhaps you are using a different settings.py
(Or localsettings.py
) on the server.
Upvotes: 0