Solving Django error ‘NoReverseMatch at’ URL with arguments ‘()’ and keyword arguments ‘{}’ not found.

Every Django developer encounters below error at least once in their life for sure.

Beginners spend many hours debugging the issue, jumping from question to question on Stackoverflow and posting in multiple groups on Facebook.

In this article we have tried to list all the common mistakes developer makes which leads them to above error.

Continue reading “Solving Django error ‘NoReverseMatch at’ URL with arguments ‘()’ and keyword arguments ‘{}’ not found.”

How to start logging errors in Django app

In development or testing environment, you may set DEBUG=True  in your settings.py  file and whenever any error is thrown, you see it in the browser.

Setting DEBUG=True  in production environment is not recommended. Debug should be set to False on live servers so that stack trace is not visible in case of any error. Hackers or malicious users may exploit this and may attack you web application.

So how do you debug you application on live servers? Answer is Logging the errors in log files.

Lets  see how to start logging errors in django?

Continue reading “How to start logging errors in Django app”

Designing custom 404 and 500 error pages in Django

It happens very frequently that a visitor on your website typed a wrong URL or the page user is looking for no longer exists. What do you do to handle such cases.

You have three options.

  • Redirect the visitor to home page, silently.
  • Show a boring 404 page and then ask them to click on a link.
  • Create your own funny/awesome/informative custom 404 error page.

In this article we will discuss the third option.

Continue reading “Designing custom 404 and 500 error pages in Django”