Reputation: 21333
I'm willing to test Django project, but I want to access it using “example.com“. Before I used “127.0.0.1:8000“ (manage.py runserver
), but now I have need to test how my project acts on different TLDs. All I want to do is somehow tell my computer that “example.com“ points to “127.0.0.1:8000“. I don't want others to have access to it, so it's not question about deployment.
I am Linux user. Any help would be much appreciated!
Upvotes: 0
Views: 578
Reputation:
Simple, edit your hosts file at /etc/hosts so that your site "example.com" maps to the localhost "127.0.0.1"
Upvotes: 0
Reputation: 599630
Just edit /etc/hosts
so that example.com
maps to that 127.0.0.1.
I don't think you can map it to a specific port number though, so you'll need to either access example.com:8000
or run the server on port 80 (probably via sudo).
Upvotes: 0
Reputation: 11744
sudo vi /etc/hosts
and add the following line at the end.
127.0.0.1 example.com
Also, if you run the web server as root, you can use port 80 and not have to type example.com:8000
into the address bar.
Upvotes: 2