I created simple form register user but something is wrong. This is my django project:
settings.py
account/urls.py
forms.py
views.py
Directories:
error:
I don't understand this issue. I use render(request, 'name_template', {}) but django request name_template. What did I do wrong?
Sorry for my english but I still learn ;)
CodePudding user response:
in your path it should be
path('register/, views.register, ....)
CodePudding user response:
Could you check your TEMPLATES section in settings.py. It looks something like this:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
},
]
Check if you have path specified to your templates in 'DIR' key. If not, then add specified path to your templates folder.
TEMPLATES_DIR = os.path.join(BASE_DIR, 'account','templates')
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIR': [TEMPLATES_DIR,]
},
]
Documentation https://docs.djangoproject.com/en/4.0/ref/settings/#templates
CodePudding user response:
you're mapped a wrong view inside urls.py
path('register/', views.render, name='register'),
Change it to
path('register/', views.register, name='register'),