Django Allowed Hosts

Answered

I am new to pycharm but brought in a project that worked fine from console and pyscripter on a local Windows box and could easily connect to a localhost in chrome

 settings.py set to but not sure it is reading this?

ALLOWED_HOSTS = [
"localhost",

System check identified no issues (0 silenced).
January 11, 2017 - 14:45:22
Django version 1.10.4, using settings 'cb_site.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

 

I get this 

DisallowedHost at /

Invalid HTTP_HOST header: '127.0.0.1:8000'. You may need to add '127.0.0.1' to ALLOWED_HOSTS.
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.10.4
Exception Type: DisallowedHost
Exception Value:
Invalid HTTP_HOST header: '127.0.0.1:8000'. You may need to add '127.0.0.1' to ALLOWED_HOSTS.
Exception Location: C:\Python35-32\lib\site-packages\django\http\request.py in get_host, line 113
Python Executable: C:\Python35-32\python.exe
Python Version: 3.5.2
Python Path:
['C:\\SiteMirror\\cb_site',
 'C:\\SiteMirror\\cb_site',
 'C:\\Python35-32\\python35.zip',
 'C:\\Python35-32\\DLLs',
 'C:\\Python35-32\\lib',
 'C:\\Python35-32',
 'C:\\Python35-32\\lib\\site-packages']
Server time: Wed, 11 Jan 2017 19:45:22 +0000
0
3 comments
Avatar
Permanently deleted user

Solved this... the RUN/DEBUG Configurations has a host  field a port and then below a run browser check box with an actual IP. 

 

I saw the IP and hist the checkbox. but left the host name out. Oddly one of my steps to fix was to add IP to my ALLOWED_HOSTS which had zero effect..

 

Oh well, hope that helps someone.

0
Avatar
Permanently deleted user

actually it WAS solved but then the IDE asked me to install a chrome plugin and since then it is not working again....

ARGH!!!!

 

Also not sure if there is a separate setup for a debugging interface but that isn't working either

 

0

Hello Chris, sorry for delay with reply. Is the problem still relevant for you? Сould you please provide screenshot with your Django settings and another one with your Run configuration? If you don't want to post it in public, please contact pycharm-support@jetbrains.com with details. Thank you!

0

Please sign in to leave a comment.