Question

Internal Server error when accessing the database

Hi,

I’m getting an Internal Server error when trying to log in to my Django app via the admin. I’ve noticed that I get the same error when trying to access my database in another way. Hopefully, you can help with the following:

  1. How can I get the log that’s causing this problem? At the moment, all I see in the runtime log is: booting worker with pid: 14
  2. Is it possible that I have a database setting wrong? To my knowledge, I’ve followed the deployment instructions carefully. Thank you in advance
Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I resolved the issue. I hadn’t specified the database_url :'), and I also got the test settings for the SMTP. Once I corrected both, the problems were resolved!

Bobby Iliev
Site Moderator
Site Moderator badge
December 13, 2023

Hi there,

In most cases, the 500 error is just a generic error, and in order to get the actual problem you would need to either check your logs or enable debugging.

Here are a few things that you could try:

  1. Accessing Detailed Logs:

    • To get more detailed logs, ensure that Django’s logging is set up correctly in your settings.py. You can configure it to log errors at a more verbose level, like DEBUG, during the troubleshooting phase.
    • Check your web server’s (like Gunicorn or Nginx) logs as well.
  2. Database Connection Issues:

    • Double-check your DATABASES setting, ensuring that all parameters like HOST, PORT, USER, PASSWORD, and NAME are correct.
    • If you’re using a managed database service, verify that your database instance is running and accessible from your Django application’s host.
  3. SMTP-Based Contact Form Issue:

    • Since the SMTP-based contact form stopped working, it’s possible that there’s an issue with your email backend configuration. Check your email backend settings in settings.py, especially the EMAIL_HOST, EMAIL_PORT, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD, and EMAIL_USE_TLS or EMAIL_USE_SSL.

Feel free to share the actual error from the error logs so that I can try to advise you further!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel