Django-registration reset password templates not getting picked up

367 views
Skip to first unread message

Vibhu Rishi

unread,
Sep 1, 2013, 2:02:14 AM9/1/13
to django...@googlegroups.com
I am getting a bit of a problem with django-registration

django-registration was installed in a venv using pip. I have version 1.0 of django-registration and 1.5.1 of Django . I have the templates/registration directory with the templates for the pages that are to display the different pages. 
login, logout, register work fine. Proper templates get picked up - and I have modified them according to my needs. 

However, now I am trying to loop in the password reset functionality. However, when I hit the URL http://127.0.0.1:8000/accounts/password/reset/ it is picking up the default django admin reset url. I cant get this to pickup my templates. Following are my settings: 

in settings.py : 

INSTALLED_APPS = (
'registration',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
   ...
)

in urls.py 

urlpatterns = patterns('',
    #django-registration
    url(r'^accounts/',include('registration.backends.default.urls')),
    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
   ...
)

what else do i need to do ? As per the django-registration documentation, the auth_urls.py is supposed to be automatically included with the default backend. But apparently, there is some disconnect here. 

Regards,
Vibhu
--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

Kelvin Wong

unread,
Sep 1, 2013, 9:07:40 PM9/1/13
to django...@googlegroups.com
TEMPLATE_DIRS needs to have the location of the templates. As long as those templates are being picked up and one is called 'password_reset_form.html' it should work.

One of my apps has this form at:

/my_project/templates_global/registration/password_reset_form.html

In /my_project/my_project/settings.py

PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

TEMPLATE_DIRS = (
    os.path.join(PROJECT_ROOT, 'templates_global')
)

The templates were all copied from django.contrib.admin.templates.registration

K


On Saturday, August 31, 2013 11:02:14 PM UTC-7, Vibhu Rishi wrote:
I am getting a bit of a problem with django-registration

Vibhu Rishi

unread,
Sep 2, 2013, 12:42:50 PM9/2/13
to django...@googlegroups.com
Thanks Kelvin for the response. However, I am not sure I understand why this is to be done. 

currently my TEMPLATE_DIRS is not having anything. it is as follows:
TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

So far, all the other template html files get picked up - except the ones related to the password management ones. 

Vibhu



--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Kelvin Wong

unread,
Sep 2, 2013, 9:28:36 PM9/2/13
to django...@googlegroups.com
If you are not using a templates folder in your project root, where are your registration templates located?

K

Vibhu Rishi

unread,
Sep 2, 2013, 9:51:33 PM9/2/13
to django...@googlegroups.com
I have a module called homepage and they reside in that. Path is as follows : 

$ ls homepage/templates/registration/
*activate.html                password_change_form.html
*activation_complete.html      password_reset_complete.html
*activation_email_subject.txt  password_reset_confirm.html
*activation_email.txt          password_reset_done.html
*base.html                     password_reset_email.html
*login_error.html              password_reset_form.html
*login.html                    *registration_complete.html
*logout.html                   *registration_form.html
password_change_done.html

The ones with * are being picked up (* added after the ls command :) ). Others are not. 

Vibhu


--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Vibhu Rishi

unread,
Sep 2, 2013, 10:01:30 PM9/2/13
to django...@googlegroups.com
Essentially the below should work (and is working for all) as I have the following template loader:

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

Vibhu

Kelvin Wong

unread,
Sep 2, 2013, 10:25:37 PM9/2/13
to django...@googlegroups.com
Check that your 'homepage' app is above the 'registration' app:

INSTALLED_APPS = (
    'homepage',  # Order matters, this is loaded before others
    'registration',
    'django.contrib.auth',
   ...
)

Order of the apps is significant. Review


As a matter of personal style, I would put them in a project template folder and not in an app templates folder.

K

Vibhu Rishi

unread,
Sep 3, 2013, 12:59:24 PM9/3/13
to django...@googlegroups.com
Hi Kevin,

You were absolutely correct. Moving 'homepage' to the top made it work. Thanks!

I was doing all my templates within a single directory pre 1.5 . But then in 1.5 they changed it, so I got a bit confused but then started putting the templates within the app. Not sure if this is good or bad. 

Vibhu


--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Kelvin Wong

unread,
Sep 3, 2013, 9:18:34 PM9/3/13
to django...@googlegroups.com
I put the overridden templates (auth, registration, etc) in a project templates folder in the project root. You have to set it up though in your settings.py as I noted earlier. The filesystem loader is still right there above the app_directories loader. To me the overridden templates don't seem to make sense in an app even if it does nothing but serve the homepage.

Templates that belong to certain apps are put into application templates folders. That makes more sense to me.

This is just personal dogma though.

K
Reply all
Reply to author
Forward
0 new messages