To give Bad Request (400) (DEBUG = False) deployment Django

    For better security, Django project at deployment, the settings.py in debug option is set to false, first appeared here can not import the _ssl of error, found python ssl module failed compiled at compile time, So now finally compile successfully. After the deployment is complete, there was a Bad Request (400) of the error message, debug found ALLOWED_HOSTS set incorrectly:

Simple version:

ALLOWED_HOSTS=['*']

A more rigorous version:

ALLOWED_HOSTS = ['.example.com','IP1','IP2']

 

example for your own domain, ip ip is authorized to access

Guess you like

Origin www.cnblogs.com/fisherpau/p/11572532.html