Reputation: 45
The following screenshot contains the code of my views.py
code:
I am getting the error:
render() missing 1 required positional argument: 'template_name'
while running the url
from pycharm
.
Any ideas why this is happening?
Upvotes: 0
Views: 14651
Reputation: 17
you can use either render(request, "template_name") or redirect('/template_name/') i've used redirect('/') to redirect to the same page
Upvotes: 0
Reputation: 26
Look at your django settings.py "TEMPLATES" DIRS configure is ok.
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',
],
},
},]
Upvotes: 0
Reputation: 810
First argument of render() is missing, update it like this :
return render (request,'blabla.html')
Upvotes: 17