macropin / django-registration

Django-registration (redux) provides user registration functionality for Django websites.
http://django-registration-redux.readthedocs.org
Other
975 stars 347 forks source link

ModuleNotFoundError: No module named 'django.contrib.sitesregistration' #263

Closed VioletLover closed 7 years ago

VioletLover commented 7 years ago

Traceback (most recent call last): File "manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/Users/yolanda/django/django/core/management/__init__.py", line 354, in execute_from_command_line utility.execute() File "/Users/yolanda/django/django/core/management/__init__.py", line 330, in execute django.setup() File "/Users/yolanda/django/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/yolanda/django/django/apps/registry.py", line 89, in populate app_config = AppConfig.create(entry) File "/Users/yolanda/django/django/apps/config.py", line 123, in create import_module(entry) File "/Users/Yolanda/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked ModuleNotFoundError: No module named 'django.contrib.sitesregistration'

joshblum commented 7 years ago

@YolandaTang from the error message I think you're missing a comma between the apps django.contrib.sites and registration. You can see an example here: https://github.com/macropin/django-registration/blob/master/test_app/settings.py#L14

VioletLover commented 7 years ago

@joshblum But I got an another error, ModuleNotFoundError: No module named 'django.core.urlresolvers'

VioletLover commented 7 years ago

@joshblum File "/Users/yolanda/PycharmProjects/tango_with_django_project/tango_with_django_project/urls.py", line 25, in <module> url(r'^accounts/',include('registration.backends.default.urls')), File "/Users/yolanda/django/django/conf/urls/__init__.py", line 39, in include urlconf_module = import_module(urlconf_module) File "/Users/Yolanda/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/Yolanda/.pyenv/versions/django/lib/python3.6/site-packages/registration/backends/default/urls.py", line 61, in <module> url(r'', include('registration.auth_urls')), File "/Users/yolanda/django/django/conf/urls/__init__.py", line 39, in include urlconf_module = import_module(urlconf_module) File "/Users/Yolanda/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/Yolanda/.pyenv/versions/django/lib/python3.6/site-packages/registration/auth_urls.py", line 27, in <module> from django.core.urlresolvers import reverse_lazy

joshblum commented 7 years ago

@YolandaTang what version of Django are you running?

VioletLover commented 7 years ago

@joshblum it's 2.0.dev20170318191452

joshblum commented 7 years ago

This library doesn't support Django 2.0 yet, the module isn't found since it was removed in Django 2.0 https://docs.djangoproject.com/en/1.11/ref/urlresolvers/#module-django.urls

VioletLover commented 7 years ago

@joshblum Well, thank you!

VioletLover commented 7 years ago

just open the registration folder and find auth_urls.py file and alter the line 'from django.core.urlresolvers import reverse_lazy' to 'from django.urls import reverse_lazy' and add 'on_delete=models.CASCADE' to the '('registrationprofile_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='registration.RegistrationProfile'))' line in the 0004_supervisedregistrationprofile.py file located in registration/migrations would work for 2.0 dev version of Django.