Django, Gunicorn, Systemd Errors

gunicorn.errors.HaltServer: <HaltServer ‘Worker failed to boot.’ 3>

Getting this error while trying to deploy a Django app? Check the logs with this command:

journalctl --unit=gunicorn | tail -n 100

With this command, you can see gunicorn trying to startup your Django app more clearly compared to .

If your systemd socket/service settings file ( ) contains the setting , make sure to check the format of your env file. It cannot be the bash script format like this:

export MY_KEY=123
export MY_OTHER_KEY=aaa

Correct format:

MY_KEY=123
MY_OTHER_KEY=aaauld

If your gunicorn is active and running from , but your website still doesn’t show up. Try the following:

Make sure your in your Django project’s has the correct domain names:

# settings.py
ALLOWED_HOSTS = ["example.com", "www.example.com"]

If you are hosting with a domain of something like or , those domains require HTTPS to even let you go to the IP address. It becomes a little circular if you are wanting to test your site on a port, as you need to enable HTTPS without testing to see if the site’s homepage works. But the homepage should be working if it works locally, and if gunicorn is throwing an access log of this sort when trying to ping your server’s IP:

"GET / HTTP/1.1" 301 0
code 400, message Bad HTTP/0.9 request type
You're accessing the development server over HTTPS, but it only supports HTTP.

All you need to do is use to enable HTTPS before testing your homepage, which is pretty straightforward from their instructions. After running , or whatever the instructions gave for your specific specs. Your domain should be ready to test if no errors came up.

If any errors came up during , consider checking your DNS records and domain provider settings.

Software Engineer living in Tokyo | Linux | Cats | https://github.com/kai-dg | https://haruspace.dev | https://ko-fi.com/harukai

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store