Sunday, December 30, 2018

Re: template location for django-registration framework

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.

On Sat, Dec 29, 2018 at 5:45 PM Zhe Li <lizhe05@gmail.com> wrote:
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/

On Saturday, December 29, 2018 at 10:22:11 AM UTC-5, Yuval Bachrach wrote:
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/a0f6a2f7-455d-4cdc-985d-acc8a810daf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

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/CAD16PYR5OgHMS5UOzDYsmYFROh0CnO6T61%3DpKhw-giT9VED1bQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment