Forums

Exception Value: Invalid HTTP_HOST header: 'mysite.pythonanywhere.com'. You may need to add u'mysite.pythonanywhere.com' to ALLOWED_HOSTS.

When I try to access to my web site adress "http://mysite.pythonanywhere.com/ the following error display: DisallowedHost at / Invalid HTTP_HOST header: 'mysite.pythonanywhere.com'. You may need to add u'mysite.pythonanywhere.com' to ALLOWED_HOSTS. Request Method: GET Request URL: http://mysite.pythonanywhere.com/ Django Version: 1.11.13 Exception Type: DisallowedHost Exception Value: Invalid HTTP_HOST header: 'mysite.pythonanywhere.com'. You may need to add u'mysite.pythonanywhere.com' to ALLOWED_HOSTS. Exception Location: /home/mysite/.virtualenvs/venv/local/lib/python2.7/site-packages/django/http/request.py inget_host, line 113 Python Executable: /usr/local/bin/uwsgi Python Version: 2.7.6 Python Path:
['/var/www', '.', '', '/var/www', '/home/mysite/.virtualenvs/venv/lib/python2.7', '/home/mysite/.virtualenvs/venv/lib/python2.7/plat-x86_64-linux-gnu', '/home/mysite/.virtualenvs/venv/lib/python2.7/lib-tk', '/home/mysite/.virtualenvs/venv/lib/python2.7/lib-old', '/home/mysite/.virtualenvs/venv/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/mysite/.virtualenvs/venv/local/lib/python2.7/site-packages', '/home/mysite/.virtualenvs/venv/lib/python2.7/site-packages', '/home/mysite/conference'] Server time: Mon, 11 Jun 2018 19:51:53 +0000

please could you help me to solve this problem

go to your settings.py and find or add a line like this

ALLOWED_HOSTS = ['mysite.pythonanywhere.com']

thank you very much it works now, I wrote ALLOWED_HOSTS = ['https://mysite.pythonanywhere.com'] instead of ALLOWED_HOSTS = ['mysite.pythonanywhere.com'] for this reason it did not work

great! @irtusb thanks!