Imported a django web app from github, and the server runs but can't connect in browser window
I'm new to repl.it. I'm running on Windows 10. Here's what I did:
Step One: I imported my Django web app from Github
Step Two: Configured .replit to include:
language = "python3" and
run = "python manage.py runserver"
Step Three: Clicked on the RUN button, with a good outcome: ("starting development server at http://127.0.0.1:8000/")
Step Four: Looked at browser window to see http://127.0.0.1:8000/ but there's a message that it refuses to connect.
I've tried turning off my windows firewall, I've tried three different browsers, I've tried updating ALLOWED_HOSTS in settings.py, and I've tried port 8080 and 3000. Still no joy.
What am I missing? It could be something simple. Thank you.
Make sure the host is 0.0.0.0:8000
not 127.0.0.1:8000
or else it will not work.
@Coder100 It is. Here is my .replit:
language = "python3"
run = "python manage.py runserver 0.0.0.0:8000"
@Coder100 I've done everything exactly as you told me. There must be one more thing I'm missing. I'll take any suggestions you've got.
@geekandglitter
oh hey look it works!
yay!! No problem :D
Mark as correct answer? @geekandglitter
Change your
.replit
to:@Coder100 When I switch to 0.0.0.0:8000, I get a Bad Request message: DisallowedHost at /
Invalid HTTP_HOST header: '1944af39-b599-40cf-a6ba-c1a9f3897dcc.id.replitusercontent.com'. You may need to add '1944af39-b599-40cf-a6ba-c1a9f3897dcc.id.replitusercontent.com' to ALLOWED_HOSTS.
Can you advise me?
add it to the allowed_hosts @geekandglitter
https://docs.djangoproject.com/en/1.11/ref/settings/#allowed-hosts @geekandglitter
simply make the allowed hosts
*
@geekandglitter@Coder100 Okay I have added * @geekandglitter to allowed hosts. Now I'm getting this message from my browser: This site can’t be reachedThe webpage at http://0.0.0.0:8000/ might be temporarily down or it may have moved permanently to a new web address.
ERR_ADDRESS_INVALID
@geekandglitter

i see this
you should be visiting https://thecattycook.geekandglitter.repl.co/ not your local machine.
@geekandglitter