Ad
TemplateDoesNotExist At /project/login/ Registration/login.html
When I try to go to my login page, I always get this:
TemplateDoesNotExist at /rubies/login/
registration/login.html
My login file is in the folder templates, just like all the other html files. I tried creating a register folder and putting it in, but it still didn't work!
Here is (part of) my settings.py file
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = [
'project.apps.ProjectConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
ROOT_URLCONF = 'project.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'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',
],
},
},
]
WSGI_APPLICATION = 'project.wsgi.application'
And my urls.py :
from django.urls import path
from rubies import views
from django.contrib.auth import views as auth_views
app_name = 'rubies'
urlpatterns = [
path('', views.index_view, name='index'),
path('register/', views.register_view, name='register'),
path('login/', auth_views.LoginView.as_view(), name='login'),
path('users/<int:user_id>/', views.user_view, name='user'),
path('users/<int:user_id>/stories/<int:story_id>/', views.story_view, name='story'),
]
Does anyone know what or where I am doing wrong? Thank you!
Ad
Answer
You should add the following to your TEMPLATES:
'DIRS': [os.path.join(BASE_DIR, 'templates'), ],
This means that Django will look at the templates from your project's /templates folder.
Ad
source: stackoverflow.com
Related Questions
- → Django, code inside <script> tag doesn't work in a template
- → Uncaught ReferenceError: Parent is not defined
- → React - Django webpack config with dynamic 'output'
- → Put a Rendered Django Template in Json along with some other items
- → Implement shopify templates in django
- → Python Shopify API output formatted datetime string in django template
- → How to avoid being crawled/penalized by Google
- → Django: Identify the urls that provide duplicate content and set a canonical link
- → Shopify app: adding a new shipping address via webhook
- → Jquery Modal Confirmation on Django form submit for deletion of object
- → changing the size of an image with css
- → shopify_auth multi store session handling
- → How to use Shopify Python API RecurringApplicationCharge
Ad