Error with adding registration to INSTALLED_APPS in settings


#1

I am working through Chapter 10 and cannot get python manage.py runserver to work when I add “registration” to my INSTALLED_APPS list. If i remove “registration” the runserver command works and I can view my page, but once I add it in, I can’t get localhost to run or anything. Please help?

repo: https://github.com/lizmeister321/hellowebapp

here is what my settings.py looks like:
INSTALLED_APPS = [
‘collection’,
‘django.contrib.admin’,
‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.messages’,
‘django.contrib.staticfiles’,
‘registration’,
]

And here is the error I get when I try and start the server:

Unhandled exception in thread started by <function wrapper at 0x10eaf11b8>
Traceback (most recent call last):
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/utils/autoreload.py”, line 226, in wrapper
fn(args, **kwargs)
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py”, line 109, in inner_run
autoreload.raise_last_exception()
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/utils/autoreload.py”, line 249, in raise_last_exception
six.reraise(
_exception)
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/utils/autoreload.py”, line 226, in wrapper
fn(*args, **kwargs)
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/init.py”, line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/apps/registry.py”, line 115, in populate
app_config.ready()
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/contrib/admin/apps.py”, line 22, in ready
self.module.autodiscover()
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/contrib/admin/init.py”, line 26, in autodiscover
autodiscover_modules(‘admin’, register_to=site)
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/utils/module_loading.py”, line 50, in autodiscover_modules
import_module(’%s.%s’ % (app_config.name, module_to_search))
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/registration/admin.py”, line 2, in
from django.contrib.sites.models import RequestSite
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/contrib/sites/models.py”, line 83, in
class Site(models.Model):
File “/Users/lizzieellis/Desktop/myhellowebapp/venv/lib/python2.7/site-packages/django/db/models/base.py”, line 102, in new
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class django.contrib.sites.models.Site doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.


#2

If you read the last line in the error it says something about Django sites. I believe if you look at Django-registration-redux documentation, you will see that the sites framework needs to be included In apps as well.

Here is a link you can see the 3 apps to be included, just copy and paste.

https://django-registration-redux.readthedocs.io/en/latest/quickstart.html


#3

Thanks for the help @tkovalsky!

One more question for @lizmeister321, what version of registration-redux are you installing? You can see the version by typing pip freeze in your command line.