1

I'm trying to access Django Developer Server from foreign IP but it is not working.

I have created a test application in the server. I've created a test virtual environment also.

I start the Developer Server using the following command:

env/bin/python manage.py runserver 0.0.0.0:8080

The server starts without any problems, but when I go to my server's IP address (not forgetting the port at the end), I get a "This site can't be reached".

Any ideas what the problem maybe? I need help in narrowing down towards a solution because I don't know where to start.

Any help would be appreciated, thanks.

Just to add, I have edited the main urls.py to show the app in the index.

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^admin/', admin.site.urls),
]

Edit to add basic server information: Linux hosting.nonprofit.net.nz 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

almost a beginner
  • 1,622
  • 2
  • 20
  • 41
  • Can you please add more details about the server (e.g. stack, outside hosting...) – Laur Ivan Jul 26 '16 at 12:20
  • What OS are you running? Are you trying to connect to your Django server from the same host or another host? (It's not clear from your question!) – Mike P Jul 26 '16 at 12:22
  • From what I know, the hosting is hosting.nonprofit.net.nz, it uses the Aegir system. I don't know much about servers. I'm accessing it through SSH, I'm not a super user, I have been given access to sub-domain which is to be used as testing ground for new app/feature of the original website before deployment. Apache2 and Python 2.7 has been installed. I've installed django within the virtual environment... – almost a beginner Jul 26 '16 at 12:33
  • @MikeP I'm using bitvise to access the server from home (SSH), I don't have direct access, that's why I'm trying run the developer server with port number, so that I can test the app from foreign IP (my home computer). – almost a beginner Jul 26 '16 at 12:35
  • why are you running `env/bin/python manage.py runserver 0.0.0.0:8080` instead of `env/bin/python manage.py runserver ServerIP:8080` ? – Dude Jul 26 '16 at 12:43
  • Because if I use the server IP then I get a "Error: That IP address can't be assigned to." Am I suppose to be using the server IP instead of the zeroes? – almost a beginner Jul 26 '16 at 12:48
  • Your command seems ok to me. Try disabling your firewall or using another port, maybe that port is used by other application. – Tomás Gonzalez Dowling Jul 26 '16 at 13:19
  • 1
    @almostabeginner chances are there is a firewall preventing you from getting to the target port. Are you able to run the development server on your local machine, rather than using the hosting server for testing? – Mike P Jul 26 '16 at 15:00
  • @MikeP Yes I can use the developer server in my local machine, but for future reference, and for learning experience, and for displaying the progress to the client, I would want to be able to access it from foreign IP. I cannot meet the client regularly so it is important for him to see the progress and advise changes through the development server: from foreign IP. I disabled my firewall in my local machine, but that didn't help. I will disable my antivirus also and update soon. – almost a beginner Jul 31 '16 at 05:23
  • @almostabeginner have a look at https://stackoverflow.com/questions/2260727/accessing-local-django-webserver-from-outside-world/35614955#35614955; it's a similar question, additional links/advice. – Mike P Aug 01 '16 at 09:12

0 Answers0