title: How do I test a database connection in Django?
body: <p>How do I test a database connection for Django? For example to make sure that the username and password of the database is correct.</p>
  
  <p>Or if it is easier, where do I "catch" the database error when database connection fails ?</p>
  
  <p>I have a scenario where database connection parameters is defined in a form by user. I need to make sure the username/password is correct and database must connect successfully before proceeding.</p>
  
  <p>I can't seem to find any documentation anywhere, as most articles assume that the database connection is always successful.</p>
  
  <p>Thanks in advance.</p>