Forums

Disallowed LOCAL_HOST Help

Hello all, I have been following up tutorial creating my first Django web app and got my first debug error log, what a coincidence! Here is the issue, I have created a basic blog with posts and uploaded to GitHub and then to python anywhere. I am following along djangogirl documentation. After completing the deployment, I get this error.

Invalid HTTP_HOST header: 'marroble.pythonanywhere.com'. You may need to add 'marroble.pythonanywhere.com' to ALLOWED_HOSTS.

Exception Location: /home/marroble/my-first-blog/myvenv/lib/python3.6/site-packages/django/http/request.py in get_host, line 113

Then I check 113 and find this below

allowed_hosts
['127.0.0.1', '<marroble>.pythonanywhere.com']

Then I do some Googling and find out this is where the settings.py is/was.

Great, so I correct it and save it.

Yet, the web blog is not up yet after doing that. I had refreshed the GitHub and and pythong anywhere and still no result, still have the error.

Please help, it has been a full day trying to figure this out. Do I need to delete the whole thing on python anywhere and restart the deployment process as well as GitHub or there is a shorter way doing this?

My solution at this point is to do the whole deployment again but before I do I figure, I should ask help here first, learn a thing or two from the Pros. Again thank you in advance if you took the time to help me out.

I think you need:

 ALLOWED_HOSTS = ['127.0.0.1', 'marroble.pythonanywhere.com']

without the angle-brackets ( < > )

Thank you for your response.

I have no idea. I had fixed it without the <> and tried again. Same results.

I had deleted everything and restarted the process and still same result.

What am I missing?

Thanks again. I had figured it out.

I went to the files section and manually edited it. I wish I had known this last night and yesterday so I could have saved so much time and effort, fixing it on local machine and re-uploading it.

Thank you again. Solved.