eclipse listening on port 8000 - django

My eclipse somehow starts listening on port 8000. I have no idea why it does so. I am using Eclipse for Python development (using PyDev tools).
This default port conflicts with default Django development server port viz 8000. I am not able to start Django development version. Off course I can shutdown eclipse, start Django and then restart eclipse, but I would prefer to disable the usage of port 8000 by Eclipse.
On Internet I saw some references to remote debugging capabilities of Eclipse, but could not figure out how to change this default port number.

I figured out that this problem was happening because of Aptana JavaScript Debug Console which attempts to start a builtin HTTP server in port range (8000 onwards whichever port it finds available first). I just changed this port range in preferences and now I am good.

If you want to start Django's development server on a another port, just add this parameter:
python manage.py runserver 8001

Related

How can I troubleshoot PCs not seeing each other over my LAN

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

mac: simplest way to safely serve a django app on port 80 for development

I'd like to open up my django app to other machines in the office during development.
I understand that it's a bad idea to run the django development server as root. The recommended way to serve a django app on port 80, even during development, appears to be django, plus gunicorn, plus nginx. This seems super complicated to me. I got the first two steps working, but am now staring at nginx in utter confusion. There's no mac build on the site. Do I really have to build it from the source?
One alternative I've come across is localtunnel. But this seems sketchy to me, and involves setting up public keys and whatnot. Is there any simpler way to serve a django app on a mac from port 80 without running it as root?
Also, just what are the risks of running a django development server on port 80 as root, vs not as root? What are the chances that someone could, say, gain total access to my file system? And, given the default user settings on a mac, is this more likely if I'm running my django dev server as root than if I'm running it as not-root?
Since you mentioned you don't want to run the Django server as root and you are on a mac, you could forward traffic from port 80 to port 8000:
sudo ipfw add 100 fwd 127.0.0.1,8000 tcp from any to any 80 in
and then run the Django server as a normal user (by default it serves on port 8000)
./manage.py runserver
To remove the port forwarding, run:
sudo ipfw flush

How can I make lein ring / jetty server accessible externally?

I'm currently attempting to start a project with Compojure.
At this point I am just trying to run the hello world app and see it through the browser.
I have a droplet on Digital Ocean with Ubuntu 13.04 installed and I cannot seem to access the webpage once the server is started.
lein ring server-headless 3000
eg: http://hostname:3000
I just get page not found. I checked to make sure jetty is using port 3000 and it is.
Am I missing dependencies?
I can't think of anything that would prevent me from viewing the page.
*Update: *
If I run the server on port 80 I can see it. I haven't added or configured any firewalls unless the Digital Ocean image comes with one by default.
on the instance run
sudo netstat -np | grep 3000
to see what address your server is listening to, if it is 0.0.0.0 then your server is listening to connections from any source and the problem is with an upstream firewall (most likely) or a local firewall (unlikely). If it is '127.0.0.1or::1/128` then your server is only listening for local connections and you need to change the binding address in the project.clj file, though this is unlikely as binding to any interface by default

Win7 Host and Ubuntu Server on Virtualbox guest port forwarding issue

I'm trying to set up what I believe to be a rather common Django development server configuration, but I'm having issues with the port-forwarding between the guest OS and the host OS.
I'm running:
Win7 Host
VirtualBox 4.1.2
Ubuntu Server 11.04 Guest.
I'm connecting to the VirtualBox with NAT and using the built-in VirtualBox Port Forwarding functionality (from the guest's Settings -> Network -> Port Forwarding menu) such that my .vbox XML contains the following section:
<NAT>
<DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
<Alias logging="false" proxy-only="false" use-same-ports="false"/>
<Forwarding name="guestdjango" proto="1" hostip="127.0.0.2" hostport="9080" guestport="8080"/>
<Forwarding name="guesthttp" proto="1" hostip="127.0.0.2" hostport="8080" guestport="80"/>
<Forwarding name="guestssh" proto="1" hostip="127.0.0.2" hostport="2222" guestport="22"/>
</NAT>
From the host, I can SSH/SFTP into the guest on port 2222, I can see the nginx "Welcome to nginx!" at 127.0.0.2:8080.
After verifying these, I set up Django and run the Django runsever:
python manage.py runserver 127.0.0.1:8080
With Lynx from the guest, I get the "Congratulations" Django page at 127.0.0.1:8080.
However, when I navigate to 127.0.0.2:9080 from the host, I get "The connection was reset."
I'm not completely sure how it works with port forwarding, but normally to expose the runserver to the external network you need to bind it to something other than localhost - ie run python manage.py runserver 0.0.0.0:8080. See if that works.

Non local connections for django project server

I ran the command python manage.py runserver 0.0.0.0:8000
It started the server up, but when I navigate to http://myipaddress:8000, my webbroswer doesnt connect. I also tried with my iphone safari brower and got the same thing.
I am using Mac OS X 10.6 and am connect to the the internet through my router.
Any suggestions on how to allow non-local connections so my friends can try out my project?
1) check your firewall
2) make sure your router forwards connections on port 8000 to your computer