Chaitanya Krishna
Chaitanya Krishna

Reputation: 39

Django site cant be reached

I run the server in c9 (django workspace). There were no errors and it said

Starting development server at http://127.0.0.1:8000//.

However, when i open this site it says

This site can’t be reached 127.0.0.1 refused to connect.

Can anyone help me fix this issue

Upvotes: 0

Views: 11577

Answers (3)

user21453299
user21453299

Reputation: 1

If you are using a proxy server, you can check the "do not use proxy for local addresses" button in the proxy settings. for me this worked.

Upvotes: 0

Cody Parker
Cody Parker

Reputation: 1121

127.0.0.1 is your local computer, not the c9 instance. The docs refer to a unique URL for each app, like: http://<workspacename>-<username>.c9users.io:8081

So, try using runserver like this: python manage.py runserver $IP:$PORT

You can then look in your browser tab for the server address that you can see your app running on, which will be similar to the one above. You'll use that when testing instead of localhost or 127.0.0.1.

Check out the Django guide on their site for more details.

Upvotes: 5

jperelli
jperelli

Reputation: 7197

In the documentation says that you use a URL they give to you (not localhost) to access the server

Use the Share button on the top to figure out the URLs of running Application and the Preview.

See https://docs.c9.io/docs/run-an-application#section--pre-view-your-application

Upvotes: 1

Related Questions