There are a few problems here that I will outline. Others have already gone some way to explain them but as Django developer, I can add some overlooked issues:
- Don't misunderstand the relation between servers, browsers and DNS. The browser needs DNS to look up a name and get an IP address to connect to. The server doesn't give a flying banana which names points to its IP.
Note: The httpd will, but not for connection purposes — it uses it to host multiple virtual hosts on one IP.
/etc/hosts can point a domain name to an IP but that's it. They can't specify port 8000. That's the browser's job.
- To host something on port 80, you need to run it as root, redirect port 80, or use
setcap to allow Python to hog port 80. The last two are very hacky but they're infinitely better than running a Django dev server as root. Please never ever do that.
- Hosting multiple Django dev servers on one IP's port 80 is impossible. They will all try to greedily bind to it and disallow further binds. You either have to stagger ports, or stick a httpd/reverse-proxy in front to split virtual hosts to Django servers.
For development I just load up the dev-server as and when I need it. I only run one at a time and it runs on the default 127.0.0.0:8000. If that model suits you and you just want to host on a custom domain name, just something like this to your /etc/hosts:
127.0.0.1 my.domain.ext sub.my.domain.ext
You can just keep chaining them on but remember that this is going to override all outbound traffic for requests on those domains. Aka: don't forget you've hacked your own DNS! From there you just load http://my.domain.ext:8000 and you're looking at your dev server.
If you want http://my.domain.ext, you're going to have to either hack things up (see above) or move to a more traditional infrastructure (below).
If you need to run multiple servers, I can really only suggest running a proper stack. I would run nginx + uwsgi + virtualenv stack. Something like what you'd use in production. In fact, the closer you can mirror your production environment, the better. If you're using Apache and modwsgi, do that.
This gives you a better testing platform. If you need to hook in on debug, I find setting uwsgi up to log (and monitoring the log) a suitable replacement for a live console output.