How can I connect to Django development server on Codenvy?

273 Views Asked by At

I'm currently testing Django on Codenvy but I have difficulties to find out how to connect to the build-in development server of Django.

I added a server in the Workspace configuration with port 8000 and http protocole.

I added the following in the run command of Codenvy's project :

Commande line :

cd ${current.project.path} && python manage.py runserver

Preview :

http://${server.port.8000}

The run prompt provide me a url : http://nodexx.codenvy.io:xxxxx

Going to this URL print a message : ERR_CONNECTION_REFUSED

I'm very new to all of this. Do you know what is missing ?

1

There are 1 best solutions below

2
Aswin Murugesh On

Django dev server by default accepts connections only from localhost. In order to access it from another machine, start runserver by binding it with an IP, or 0 for the app to be accessed from everywhere.

python manage.py runserver 0:8000

The above command runs the server in 8000 port, binding the network to 0.0.0.0, which means the app can be accessed from anywhere