I have a small project with basic crud operations done in django, in my local it works fine, now I have uploaded it into a live domain, and run the project,It has run without any issues,
Performing system checks...
System check identified no issues (0 silenced).
May 22, 2017 - 10:20:14
Django version 1.11.1, using settings 'callluge.settings'
Starting development server at http://127.0.0.1:8001/
Quit the server with CONTROL-C.
So far so good, Now my question is, how could I see this in browser, if i simply access http://127.0.0.1:8001/ browser shows "Unable to connect",
if my domain name is say "osho.com", how should see the project interface in browser.Please help.
Run your server on public ip address of server . 127.0.0.1 is a localhost and it will be available within the your system. outside the machine you can't access this ip address.
So you have to run the server on public ip address of server.
Related
So I have set up my Django server through an SSH connection to my remote server. It shows me that the server is actually running:
August 10, 2020 - 04:09:47
Django version 3.1, using settings 'risk_areas.settings'
Starting development server at http://xx.xxx.xxx.xxx:8000/
Quit the server with CONTROL-C
However, if I try to go to the URL above (with my IP address in it) it gives me a connection time out error. What might be the reason for this?
I'm a complete newbie when it comes to networking. I have two PCs on my LAN both running Manjaro. My main aim is to test functionality on a Django server running on one PC, from the other. I am running the Django server on the PC with ip address 192.168.1.138 using the command
python manage.py runserver 192.168.1.138:8000
and in settings.py
ALLOWED_HOSTS = ['localhost', '192.168.1.138']
I can ping 192.168.1.138 from the client PC, and ping the client PC from the server PC. But if I enter the ip address/port into the browser, it fails with
took too long to respond
I don't know if this a separate problem or a manifestation of the first, but when I run NitroShare, I am able to 'see' the PC running the Django server from the PC acting as the client, but if I try to transfer a file, again it times out. I am unable to see the client from the server in NitroShare.
Any suggestions or help gratefully received
Ensure you don't have a firewall running (or that it allows connections to port 8000). Manjaro's docs imply there might be no firewall by default, but in case there is, see https://wiki.manjaro.org/index.php?title=Firewalls
Set ALLOWED_HOSTS = ['*'], don't bother with limiting them.
Run with python manage.py runserver 0:8000 ; the 0 stands for 0.0.0.0, i.e. has the server listening on all network interfaces.
First I would scan with the other PC the open ports of you "Server"-PC, you can do that with tools like Nmap. Make sure you opened the ports of your "Server"-PC at your router interface. Another option could be the launching of the django app in a docker container. Here's the link of the official docker image at DockerHub:
https://hub.docker.com/_/django
I am trying to access Django server from outside the device but within LAN. I have exposed my port 8000 for same and then ran -
python manage.py runserver 172.30.xxx.xxx:8000
Now, while trying to connect from other device using link http://172.30.xxx.xxx:8000 , I end up getting "The connection was reset" in browser. In the Django console it shows "Not Found: /".
But if I try to access the same link from the device where server is running I am able to access.
What might be the possible glitch here?
To make your development server viewable to other machines on the network on LAN, this procedure works for me
Run the server like this python manage.py runserver 0.0.0.0:8001
Access the server 192.168.1.xxx:8001(this IP will be different for you) from another station on the LAN
So, it turns out there was a problem with gateways in LAN. Accessing from same gateway lets me access the site.
Upon running the the dev server 0.0.0.0:8000, I cannot see the website loaded in the browser.
While going through some of the reasons why this might happen, I have done the following changes:
ALLOWED_HOSTS = ['*']
Killed all processes on 8000
firewall turned off
The server I am working on is RHEL.
System check identified no issues (0 silenced).
April 01, 2019 - 04:39:38
Django version 2.1.7, using settings 'gig_bank.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
//Nothing is displayed in the browser.
Since you specified that it's a remote server, it most likely be a firewall issue,
you need to make sure port 8000 is open, you could test it using netcat as following :
nc -zv -w1 ip port
if the server is inside a cloud you need to add the rule to your cloud console, turning off the firewall in the server won't suffice.
Just in case the firewall on the server wasn't actually off, you could run sudo ufw allow 8000/tcp (For linux user)
This is probably a very basic question. I SSH to my virtual Ubuntu server and start a django webserver running on localhost:
Downloading/unpacking django
Downloading Django-1.9.5-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded
Installing collected packages: django
Successfully installed django
Cleaning up...
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
April 13, 2016 - 14:16:19
Django version 1.9.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
The Ubuntu server has a static IP [x.xxx.xxx.xxx] so from another machine on another network I try to access the above website in a browser using that static IP address:
x.xxx.xxx.xxx:8000
But I get:
This site can’t be reached
x.xxx.xxx.xxx refused to connect.
ERR_CONNECTION_REFUSED
So I assume that I cannot access the website like this and that is only available on the host it self even though the host has an external/static IP address?
Edit:
The answer is also in:
https://docs.djangoproject.com/en/1.9/intro/tutorial01/#the-development-server
python manage.py runserver 0.0.0.0:8000
You need to run your web server on 0.0.0.0:8000, then externally you would use either ip or host name to access. Using 0.0.0.0 means the django service would listen to all configured network interfaces.
Check wikipedia on details about 0.0.0.0.
Another answer on serverfault could be helpful.