tags:

views:

57

answers:

4

I have downloaded django and have followed the instructions to deploy my first website:

In the docs, it says:

"Now that the server's running, visit http://127.0.0.1:8000/ with your Web browser. You'll see a "Welcome to Django" page, in pleasant, light-blue pastel. It worked!"

The problem is that I am not running the website locally, instead, it is on a remote machine. Additionally, I have Apache running on that machine, so when I type:

http://my_ipaddress

I get the default apache page.

When I run http://my_ipadress:8000

I get the error (in my browser);

Oops! Firefox could not connect to [MY_IPADDRESS]:8000

How may I resolve this?

A: 

Make sure that the port you're trying to use (8000) is forwarded by your router.

JC Leyba
+1  A: 

Right now, you are running a development server, and by default, it prevents the web page from being hosted to a remote client. The way to get around this is in the section called "Changing the port" in the docs you linked:

If you want to change the server's IP, pass it along with the port. So to listen on all public IPs (useful if you want to show off your work on other computers), use:

python manage.py runserver 0.0.0.0:8000

karlw
karlw: thanks very much!
skyeagle
A: 

If you follow the basic directions, you'll start your server as follows:

python manage.py runserver

This will start a server that listens on port 8000 on localhost (127.0.0.1).

You can add additional parameters to specify a different host / port:

python manage.py runserver 0.0.0.0:8000

This will cause your server to listen on all available interfaces, on port 8000, which should meet your needs. If port 8000 is already in use, just choose a different port number, as long as it is greater than 1024.

Craig Trader
A: 

you should try [YOUR_SERVER_IP]:8000

Don't forget you're not supposed tu run a development server in production and should prefer apache_wsgi

vinyll