"DisallowedHost " message despite correctly adding host address to settings.py

0

Right, any particular valid reason as to why Django is telling me that I "may need to add '13.53.67.74' to ALLOWED_HOSTS" despite the fact that I have already done this?

IP added to ALLOWED_HOSTS

DisallowedHost at /

I literally have no words to describe how sick to the back teeth I am of Django right now.

My Git (although there is only one Git I can think of right now, and it's not Git Hub) repository has been correctly linked and cloned. Inbound security rule from within the NSG has also been set up correctly. Seriously, genuine question: is this thing thick?!

This happens every single time, no matter what I do, it does not matter what I try, I get the same absolute shite every single time with this thing. I am so tired. I am so sick to death. Why do I have to rip my hair out every single time I do this? Why do I have to scream? Why do I have to see the same bloody result every single time? Why is it that every single bloody time I get error messages for non-existent issues her? Why Why WHY?!

I even changed me ALLOWED_HOSTS to ALLOWED_HOSTS = ['*'].

Guess what?

Yep, you guessed it, still the same result.

Shocker there, except it's not a shock is it? Because like I said earlier, it makes no difference what I do, I still get the same result. If you're going to develop a product to host your website on, why is it not being tested to make sure it actually works? What is the actual point of giving actions to action the solution to the problem if your product is going to just give the user the same result.

Absolutely stupidity.

Swear to God if this thing was a person, its father would most definitely also be its uncle.

I could just scream.

asked a month ago160 views
2 Answers
1

Please ensure the host is added with its port in the ALLOWED_HOSTS configuration:

ALLOWED_HOSTS = ['13.53.67.74', '127.0.0.1', '13.53.67.74:8000',  '127.0.0.1:8000']

NOTE: This is not recommended for production as it's not the standard use and can expose the application to unnecessary risks.

profile picture
EXPERT
answered 23 days ago
  • Noted, however still didn't work (no surprise there). BUT I do see in the Django debug page that under Request Information > Settings it's telling me that it's trying to access ALLOWED_HOSTS = ['127.0.0.1'] DESPITE correctly updating the ALLOWED_HOSTS variable in the settings.py. Its like It has not had another look at this and gone "Oh I see you have updated this, sorry!"

    Why? For a seemingly reputable company, which is an absolute disgrace

  • Could you please share the ALLOWED_HOSTS section of your settings.py file to help identify the issue?

    ⚠️ Make sure to redact any sensitive information before sending it over.

    This is the error invalid HTTP_HOST header, isn't this? Which Django version are you using? Do you have this USE_X_FORWARDED_HOST enable in your settings.py?

  • You know, I think I'm developing some sort of psychic ability here. I mean, how did I know that sticking an :8000 after the ALLOWED_HOSTS will yield the same bloody result? It's amazing How I have attained this ability, is it not? These Instances are so thick its almost funny.

    Yes, that is the error, I'm using Django 5.0.bloody4 and No I am not using USE_X_FORWARDED_HOST because it should sodding work without it! Why is Django refusing to connect to the correct IP address?

  • In addition to this, I am just about to seriously lose my temper. If I see that error one more time I am seriously going to start screaming. I am sick to death of this.

0

Have you restarted the Django services?

From a terminal, something like the following command

systemctl restart uwsgi.service
profile pictureAWS
answered a month ago
  • Yep., authentical failed despite entering correct credentials. Proves my point. AWS making non-existent issues. So sick of this. Why can't something just bloody do as its told?!

    But of course, something just work as it should would simple make my life so much easier, wouldn't it? We can't have that, now, can we? We can't just have something just do as its told. Oh no, I have to scream, I have to shout, I have to cry, I have to absolutely go bat sh*** crazy, don't I? IU have to have my entire day ruined just because I constantly end up using complete garbage SAAS.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions