RuntimeError at /home
You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/home/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
Request Method: POST
Request URL: http://127.0.0.1:8000/home
Django Version: 3.1.2
Exception Type: RuntimeError
Exception Value:
You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to 127.0.0.1:8000/home/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.
Exception Location: C:\Users\Deepak\AppData\Local\Programs\Python\Python39\lib\site-packages\django\middleware\common.py, line 87, in get_full_path_with_slash
Python Executable: C:\Users\Deepak\AppData\Local\Programs\Python\Python39\python.exe
Python Version: 3.9.0
Python Path:
['C:\Users\Deepak\protfolio',
'C:\Users\Deepak\AppData\Local\Programs\Python\Python39\python39.zip',
'C:\Users\Deepak\AppData\Local\Programs\Python\Python39\DLLs',
'C:\Users\Deepak\AppData\Local\Programs\Python\Python39\lib',
'C:\Users\Deepak\AppData\Local\Programs\Python\Python39',
'C:\Users\Deepak\AppData\Roaming\Python\Python39\site-packages',
'C:\Users\Deepak\AppData\Local\Programs\Python\Python39\lib\site-packages']
Server time: Sat, 16 Jan 2021 06:27:38 +0000
Asked
Active
Viewed 251 times
0
-
Please style your code accordingly https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks – Marco Jan 16 '21 at 10:21
1 Answers
0
The error clearly says that your form was posted to /home
But it could not find /home in URL patterns. Change the POST URL in your template.
Also, check Django doc which mentions that data loss could happen for forms when Django tries to redirect.
When set to True, if the request URL does not match any of the patterns in the URLconf and it doesn’t end in a slash, an HTTP redirect is issued to the same URL with a slash appended. Note that the redirect may cause any data submitted in a POST request to be lost.

Marco
- 2,371
- 2
- 12
- 19