[Django]-Getting stuck at Django error: No module named registration

8👍

There may be Python errors in your registration models. Try starting a shell and importing them, instantiating them, etc.

👤John G

30👍

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.

15👍

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',
)

11👍

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.

👤Carlos

7👍

just do this in your virtualenv

pip install django-registration

👤AmiZya

5👍

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!

4👍

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.

2👍

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

2👍

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 

1👍

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

0👍

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.

👤lprsd

0👍

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 .............

0👍

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.

0👍

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.

0👍

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

-1👍

I ran into this problem because I was messing up with my virtualenv.

I had two windows open:

  1. Running the server
  2. Running my commands

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.

Leave a comment