I am trying to install and run Django-registration-redux and whenever I try to include 'registration' in installed apps I am getting an error:
Traceback (most recent call last):
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\utils\autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\apps\registry.py", line 115, in populate
app_config.ready()
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\contrib\admin\apps.py", line 22, in ready
self.module.autodiscover()
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\contrib\admin\__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\django\utils\module_loading.py", line 50, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\AdamSmith\projects\myvenv\lib\site-packages\registration\admin.py", line 2, in <module>
from django.contrib.sites.models import RequestSite
ImportError: cannot import name RequestSite
I have freshly installed Django in myenv virtualenv. manage.py runserver is working fine and loading admin page perfectly without 'registration' app included. FYR: I am using python27 and here is my pip freeze for myenv:
> pip freeze
Django==1.9
django-registration-redux==1.2
wheel==0.24.0
and settings.py inludes the following apps:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'registration',
]
Do you have any idea on what is the problem here?
I ran into the same error (take a look at the docs, Site
is under django.contrib.sites.models
and RequestSite
under django.contrib.sites.requests
). Replace :
from django.contrib.sites.models import RequestSite
by
from django.contrib.sites.requests import RequestSite
in [YourPath]/admin.py
, (it's C:\Users\AdamSmith\projects\myvenv\lib\site-packages\registration\admin.py
in your case).
This issue is fixed in django-registration-redux 1.3. See https://github.com/macropin/django-registration/issues/132.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With