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 ?
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
Related
We have a dev server with the internal hostname dev1.internal.blah.com running nginx. I'm trying to create a test Django project testproject from the Django tutorial on this server. I access this server by ssh-ing into it.
So on this server I installed Django, created a new directory, issued django-admin startproject mysite within it, then issued python manage.py runserver 8765 and got the
success message Starting development server at http://127.0.0.1:8765/
Now how would I access the http://127.0.0.1:8765 site from a browser? I tried using http://dev1.internal.blah.com:8765 but got a This site can't be reached error message.
If I try curl http://127.0.0.1:8765 from the terminal, I see the correct html being rendered.
The nginx www directory is located at /usr/share/nginx/html if it helps.
By default, Django development server runs on port 8000 on the IP address 127.0.0.1, but note that that IP address is accessible only from your own server.
To make the runserver viewable to others, use either its own IP address or 0.0.0.0. or :: with IPv6 enabled.
So, you should probably run it like this:
python manage.py runserver 0.0.0.0:8765
I am new to Django Project. I have my app moved to my production server and I have it run:
$ python manage.py runserver
>>> Starting gulp watch
>>> gulp watch gulp process on pid 30427
Validating models...
0 errors found
May 18, 2017 - 15:57:08
Django version 1.5.12, using settings 'website.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
But it is a production server with an IP, eg: 119.237.27.131
So it can't be running at http://127.0.0.1:8000/
Then what should I do so that the app is running on http://119.237.27.131:8000/ instead?
Any ideas?
Btw, where is 'website.settings'?
EDIT:
When I check the app at http://119.237.27.131:8000/
I get this error:
This site can’t be reached
119.237.27.131 refused to connect.
If you start the development server without any parameters, the server will start at localhost:8000, but it can't be accessed from outside the machine. To allow that, you should start the server like this:
python manage.py runserver 0.0.0.0:8000
That will allow you to connect from another machine, on the machine's IP address, like http://119.237.27.131:8000/
A word of warning: the development server is not a production-ready server. You should use a WSGI server like Gunicorn or another tool to serve your application. Do not use the development server in a production setting, it's not safe!! Read more about that here.
I created one EC2 instance for Django project with Ubuntu server.
I installed all required package of django, python etc successfully.
But when I am trying through ssh with private ip : python manage.py runserver xxx.xx.xx.xx:8983 its running, but when I am trying to load it through browser its gives as error : "The Connecion has timed out"
I have assigned VPC security group to this instance.
Also, I try with public IP address through SSH: : python manage.py runserver XXX.XX.XX.XX:8983
It gave error as follows :
Validating models...
0 errors found
July 15, 2015 - 22:34:10
Django version 1.6.7, using settings 'conf.settings.local'
Starting development server at http://xx.xx.xxx.xx:8983/
Quit the server with CONTROL-C.
Error: That IP address can't be assigned-to.
And same error occurred when I run in browser.
I also tried following both options but no luck
0:8000
0.0.0.0:8000 port running successfully in ssh with python manage.py but not in browser.
I checked /etc/network/interfaces this file, following lines already exists there:
auto lo
iface lo inet loopback
Anybody has any other solution?
Daya,
I try run with port 0:8000 0.0.0.0:8000 but no use.
Also, /etc/network/interfaces file was perfect.
But In my case, solution for this problem was to change script file's location.
I mean to say my django application folder location was /home/ubuntu
but when I move it to /Var/www it worked.It worked because server is apache2.
I am testing RTD to build our API docs implementation, so running a local installation of RTD in a virtualenv within a debian VM. The ./manage.py runserver command runs the RTD server successfully.
Validating models...
0 errors found
March 25, 2015 - 03:11:57
Django version 1.6.10, using settings 'settings.sqlite'
Starting development server at http://127.0.0.1:8000/
To access the RTD admin console from my laptop browser (outside the VM) I would like to change the localhost to the public IP. For that, I changed the IP references in:
/etc/hosts
settings/sqlite.py (section
Internal_ips, and a few other occurrences)
But, it continues to build the server at http://127.0.0.1:8000/
Where should I be configuring this? What else should I be doing?
RESOLVED
Run the RTD server as:
./manage.py runserver 0.0.0.0:8000
OR
./manage.py runserver [VM IP ADDRESS]:8000
I am trying to debug an issue that happens on our testing server. So how do I make it so that I can access our testing server when I start Django by typing:
python manage.py runserver
?
Does it have to pass through Apache? If so, I need to configure Apache somehow but I am not using mod_wsgi and so, don't know how to do this.
Thanks! :)
the test server runs its own web server. the defaul options starts a server on
http://127.0.0.1:8000/, which you can then open in your browser
you can specify an optional ip address/server using
manage.py runserver ip:port
using ip 0.0.0.0 for all network interfaces