I get Bad Request (400) on my localhost when my DEBUG = False. Even I configured ALLOWED_HOSTS. I have been searching all over stackoverflow but still can't find the source of the problems.
I'm thinking the 400 is coming from something else and isn't related to the ALLOWED_HOSTS, because your config is right. Look at this, maybe it helps
- Jesse
That's what I thought too but it is clear that the bad request only appears when the DEBUG = False. I checked on that link but they don't answer my issue.
- sdg
Try making a new, fresh project and just change those two configs and see if it works. That rules out any issues from your python or django installs. If that doesn't work, see if any middlewares you've installed are causing the problem. Commenting out things in your config is a surprisingly effective way to narrowing down a problem like this.
- Jesse
1 Answers
0
votes
Try adding '*' to the list just in case and see if that helps.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more
localhost. What version of Django are you using? - JesseALLOWED_HOSTS, because your config is right. Look at this, maybe it helps - Jesse