Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Django Basics What a View! What Are URLs?

Don't really understand 0.0.0.0:8000

I can't get my head around this, but from what I understand, we've set up a server, and this is the address? I'm following along in Pycharm, and it's there I've been editing our learning_site. I kept getting errors when I tried going to '0.0.0.0:8000' in my browser, so I went into settings.py and added '0.0.0.0' to the ALLOWED HOSTS, and now I can see 'Hello World' when on http://0.0.0.0:8000. Is this address only accessible from my laptop? How would someone else access this? Would I need to add another device's IP address to ALLOWED HOSTS for them to access it? What if multiple people were working on this project? If anyone could help me by giving me a rundown of how we've created this server address and how we're connecting to it, had a look through a few posts on Stackoverflow but still can't get my head around it.

Christopher De Lette
Christopher De Lette
Courses Plus Student 7,139 Points

Hi Ross,

Mind you this is only coming from my background as a Network Admin dealing with routers and switchs, not from a Server side. The 0.0.0.0 address means a default route, or anyone can access because of the masking/matching rule on a subnet. By adding this entry into your servers settings entry you've basically allowed any PC's/connected devices in your LAN to access this server on said port (which happens to be 8000, hijacked from 8080 <--- web port). From what i understand if you wanted to allow outside access you would bind the address to your outside interface for public access (not recommended on your local LAN unless you have the proper security in place) or host it. For development you could allow outside access by port forwarding the port to your development server in your router/modem.

If anyone can elaborate on the Python/Django piece of Ross' question please so i can understand as well.

Hope this somewhat clears things up and didn't muddy the water more.

Take care!

1 Answer

Haydar Al-Rikabi
Haydar Al-Rikabi
5,971 Points

This link within the community forum may have the answer to your question: https://teamtreehouse.com/community/run-server