How to override my template instead of django admin panel for reset password?

You can also make sure that your app comes before all other Django apps in INTALLED_APPS e.g

INSTALLED_APPS = [
'your_app_name',

'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
]

replace your_app_name with the name of your app


In your settings.py make sure your TEMPLATES settings is equal to the following

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, 'templates')],
    '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',

        ],
    },
},]

the most important part here is the DIRS


I struggled with this for hours. I tried rewriting the admin template I thought against it so I didn't have to rewrite it for every new project.

finally stumbled across the answer on a blog referencing the Django 2.1 docs: "http://discuss.hellowebapp.com/t/django-2-1-changes/618/4". The blog explains the changes to path formatting and views syntax.

FILE STRUCTURE

###`blog/templates/registration/reset_password_form.html`###
###`blog/templates/registration/reset_password_done.html`###
###`blog/templates/registration/reset_password_complete.html`###
###`blog/templates/registration/reset_password_confirm.html`###
C:.                                                                   
├───blog                                   
│   │   admin.py                           
│   │   apps.py                            
│   │   forms.py                           
│   │   models.py                          
│   │   tests.py                           
│   │   urls.py                            
│   │   views.py                           
│   │   __init__.py                        
│   │                                      
│   ├───migrations                         
│   │                                      
│   ├───static                             
│   │   └───css                            
│   │       │   blog.css                   
│   │       │                              
│   │       └───static                     
│   │           └───images                 
│   │                                      
│   ├───templates                          <-------
│   │   │   add_comment_to_post.html       
│   │   │                                  
│   │   ├───blog                           
│   │   │       base.html                  
│   │   │       postDraftlist.html         
│   │   │       postEdit.html              
│   │   │       postsDetail.html           
│   │   │       postsList.html             
│   │   │                                  
│   │   └───registration                   <-------
│   │           home.html                  
│   │           login.html                 
│   │           password_reset_complete.htm    <---
│   │           password_reset_confirm.html    <---
│   │           password_reset_done.html       <---
│   │           password_reset_form.html       <---
│   │                                      
│   └───__pycache__                        
├───blogApp                                
│   │   settings.py                        
│   │   urls.py                            
│   │   wsgi.py                            
│   │   __init__.py                        
│   │                                      
│   └───__pycache__                            
│                                          
└───sent_emails                            
|          
│___.gitignore                             
│___db.sqlite3                             
│___manage.py                              
│              

.

from django.contrib import admin
from django.urls import path, include
from django.views.generic.base import TemplateView
from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView

urlpatterns = [
    path('admin/', admin.site.urls),
    #127.0.0.1:8000
    path('', include('blog.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('', TemplateView.as_view(template_name='home.html'), name='home'),
    path('accounts/password/reset/', PasswordResetView.as_view(template_name='registration/password_reset_form.html'), name='password_reset'),
    path('accounts/password/reset/', PasswordResetDoneView.as_view(template_name='registration/password_reset_done.html'), name='password_reset_done'),
    path('accounts/password/reset/', PasswordResetConfirmView.as_view(template_name='registration/password_reset_confirm.html'), name='password_reset_confirm'),
    path('accounts/password/reset/', PasswordResetCompleteView.as_view(template_name='registration/password_reset_comlete.html'), name='password_reset_complete'),

SETTINGS

INSTALLED_APPS =  [
    'blog',   #<--name of your app should go here at the top of this stack not bottom
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],

So:

  1. file structure:templates/registration/password_reset_form.html
  2. urls.py: imports and paths
  3. settings.py: INSTALLED_APPS and DIRS