<pre><code>
def login(request):
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username,password=password)
if user is not None:
auth.login(request,user)
return redirect('/')
else:
messages.info(request,'Invalid Credendials')
return redirect('login')
return render(request,'login.html')
def contact(request):
return render(request,'contact.html')
<code><pre>
urls.py
<pre><code>
path('login',views.login,name='login'),
path('contact',views.contact,name='contact'),
<code><pre>
I was expecting to put login in without adding / at the end. changing urls.py seems to work but would be better if i can make it like this without /
contact
urls.py
path('login/',views.login,name='login')
in setting.py put
APPEND_SLASH = False
Add manually as newer version off django have it in CommonMiddleware of middleware
You can read more here : https://docs.djangoproject.com/en/1.11/ref/middleware/