template location for django-registration framework

693 views
Skip to first unread message

Yuval Bachrach

unread,
Dec 29, 2018, 10:22:11 AM12/29/18
to django...@googlegroups.com
I have installed "django-registration:" and now follow "https://django-registration.readthedocs.io/en/3.0/quickstart.html

I have set URLs as explained (see below) but failed to tell django where to find the templates.

What do I need to do to have django find the templates?


More details:


is resulted with an error: 

TemplateDoesNotExist at /accounts/register/

django_registration/registration_form.html
Request Method:GET
Request URL:http://127.0.0.1:8000/accounts/register/
Django Version:2.1.3
Exception Type:TemplateDoesNotExist
Exception Value:
django_registration/registration_form.html
Exception Location:C:\Program Files (x86)\Python37-32\lib\site-packages\django\template\loader.py in select_template, line 47
Python Executable:C:\Program Files (x86)\Python37-32\python.exe
Python Version:3.7.1

I have tried to locate registration_form.html at django_reistration/reister/templates at "django_registration\registration\templates\registration" under my project.  
Also tried "django-registration\registration\templates\registration" and several other locations but I keep getting the error message. 

The problem could be the template location or  a missing setting,...
  • I added no app to the "INSTALLED_APPS" at setting.py
  • my template is:
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        # changed at tutor7
        # 'DIRS': [],
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        # DIRS is a list of filesystem directories to check when loading Django templates; it’s a search path
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]



from django.conf.urls import include, url

urlpatterns = [
    # Other URL patterns ...
    url(r'^accounts/', include('django_registration.backends.activation.urls')),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    # More URL patterns ...



--

Yuval B

Zhe Li

unread,
Dec 29, 2018, 10:45:03 AM12/29/18
to Django users
Have you searched the internet before posting?

https://stackoverflow.com/questions/6127264/troubleshooting-templatedoesnotexist-at-accounts-login-django-auth-setup

You can either create your own pages or copy the whole templates under the django admin site -- site-packages/django/contrib/admin/templates/registration/

Yuval Bachrach

unread,
Dec 30, 2018, 12:42:12 PM12/30/18
to django...@googlegroups.com
First: thank you!
Yes I did search before asking
I was trying to place the templates under my project tree (rather than under "Python37-32\Lib\site-packages\django\contrib\admin\templates\registration" and could not make it work.
Per you advice I also tried putting the template file at the above mentioned directory as a temporary solution but I still get the same error message.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a0f6a2f7-455d-4cdc-985d-acc8a810daf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Yuval B

Yuval Bachrach

unread,
Dec 31, 2018, 9:25:08 AM12/31/18
to django...@googlegroups.com
(the suggested url: I saw it before writing the message. It is outdated. Example: It uses "python manage.py syncdb"
Besides: It instruct adding to INSTALLED_APPS : "    'registration'": This yield errors: First reason: A comma is missing..
I also think, but not sure,that this line is not relevant anymore..)
I now see that I get an error message with runserver:
ModuleNotFoundError: No module named 'django_registration.backends'
That has to do with addition added to url.py under urlpatterns
The line cause the error message is:
    url(r'^accounts/', include('django_registration.backends.activation.urls')),  
  while the following line works fine.
  url(r'^accounts/', include('django.contrib.auth.urls')), 

Note that url.py exists at Python37-32\Lib\site-packages\django_registration\backends\activation
I am new to django still could not making the error to go away. I noticed that there are no __init__.py files at "lib" as well as at "site-packages".
(I could not  believe it is the reason for the error and nor that I should make changes there but I tried adding empty __init__.py anyway...)
So what should I do to resolve the  ModuleNotFoundError: No module named 'django_registration.backends' error?

  
--

Yuval B

Reply all
Reply to author
Forward
0 new messages