Django: DisallowedHost Error
Hosts.
DisallowedHost means the address used to reach the site is not in ALLOWED_HOSTS in your Django settings. With DEBUG=False Django refuses unknown hosts.
Step 1: Read the message

It says Invalid HTTP_HOST header: 'example.com'. You may need to add 'example.com' to ALLOWED_HOSTS. That host name is what you must add.
Step 2: Open settings

Edit your settings.py or the production settings file.
Step 3: Add the hosts

Set ALLOWED_HOSTS = ['example.com', 'www.example.com']. Add the server IP if you use it directly.
Step 4: Mind the format

Use only the host name, with no https:// and no path. A leading dot such as .example.com allows subdomains.
Step 5: Check your environment file

If settings come from environment variables, update the value on the server.
Step 6: Restart the app

Restart Gunicorn or your process manager so the change loads.
Step 7: Watch the proxy

If a proxy passes a different Host header, check the proxy settings too.
Still stuck?
If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.
Related guides
- Writing Clear Error Reports: Screenshots, URLs and Steps
- WordPress Tag and Date Archives Duplicate Content: Settings
- WordPress Permalinks Change: Redirect Old URLs and Avoid 404s
- Error Establishing a Database Connection in WordPress: Full Checklist