cookiecutter-django
cookiecutter-django copied to clipboard
0.0.0.0:8000 This site can’t be reached
What happened?
When I start PyCharm with the "runserver" configuration and call http://0.0.0.0:8000/ with Google Chrome, I get the message "This site can't be reached".
What should've happened instead?
The website should load.
Additional details
- OS name and version: Windows 10
- Python version: 3.10.4
I think 0.0.0.0 just means to expose the port for other devices. FOr instance, if you try to connect with your phone to your local/private ip address like http://192.168.0.2:8000
, then it works. Same with http://localhost:8000
. That'll work too. 0.0.0.0 isn't an IP address I believe
Then shouldn't cookiecutter-django default to 127.0.0.1?
Wdym default to?
the mention address should be run in your local system like this in pycharm editor
It works fine on my machine (macOS) with Docker (which I thought was the problem). Is 0.0.0.0 a special IP address that is working differently on Windows? What options have you selected when generating the project? This is in the issue template but I don't see it in the original report... 😞
* Options selected and/or [replay file](https://cookiecutter.readthedocs.io/en/latest/advanced/replay.html):
On Linux and MacOS: `cat ${HOME}/.cookiecutter_replay/cookiecutter-django.json`
(Please, take care to remove sensitive information)
```json
# Insert here the replay file content
```
(Yes, the questions we're asking in the issue template are actually useful, please fill them...)
{ "cookiecutter": { "project_name": "www.flashlightapp.com Flashlight App for Android", "project_slug": "flashlightapp", "description": "Flashlight App", "author_name": "Flashlight", "domain_name": "flashlightapp.com", "email": "-", "version": "2.1.0", "open_source_license": "Not open source", "timezone": "UTC", "windows": "y", "use_pycharm": "y", "use_docker": "n", "postgresql_version": "14", "cloud_provider": "None", "mail_service": "Other SMTP", "use_async": "n", "use_drf": "n", "frontend_pipeline": "None", "use_celery": "n", "use_mailhog": "n", "use_sentry": "n", "use_whitenoise": "y", "use_heroku": "n", "ci_tool": "None", "keep_local_envs_in_vcs": "n", "debug": "y", "_template": "https://github.com/cookiecutter/cookiecutter-django", "_output_dir": "C:\Users\flashlightapp\Downloads\cookiecutter-django-test\1" } }
In my opinion, it is not a bug at all.
When you run your application on host 0.0.0.0:8000, the application is bound to all network interfaces on the machine it is running on. This allows the application to be accessible from any device connected to the same network as the machine running the application.
However, when you try to access the application using the address 0.0.0.0:8000 in your browser, the browser may not be able to resolve the IP address correctly. This is because 0.0.0.0 is a special IP address representing all network interfaces on the local machine, but it is not a valid IP address for external connections.
On the other hand, when you use the address 127.0.0.1:8000, you are accessing the application through the loopback interface, a virtual network interface that allows a client to connect to a server running on the same machine. This address is always available and accessible from the same machine the application runs on, regardless of the network configuration.
To access your application from another device on the same network, you should use the IP address of the machine running the application instead of 0.0.0.0:8000.
To make a long story short - it is not a bug, it is how networking works, and you should use 127.0.0.1:8000 when you run your application on localhost.