Saturday, December 29, 2018

template location for django-registration framework

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

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAD16PYSFse0On6tqDU-TjLyeaGivc0oCB3v2VBhirBMqphohEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment