server can't connect in browser

253 views
Skip to first unread message

Deep Kamal

unread,
Jun 22, 2022, 9:07:18 AM6/22/22
to Django users
Hi all,
I am quite new in django. Just started my first project in it.
I started an ec2 instance, setup virtual environment and run server through 
python manage.py runserver command.
Server is up with no errors. But when I copy the link and open in browser it says site can't be reached. Screenshots of it are attached for reference.
site can't connect.png
server running.png

Antonis Christofides

unread,
Jun 22, 2022, 10:59:59 AM6/22/22
to django...@googlegroups.com

Hello,

If you insist on working this way, there are two things you need to do:

  1. You need to run it with "python manage.py runserver 0.0.0.0:8002".
  2. 127.0.0.1 is the wrong address. Find the IP address of the server and use that one.

Typically, when developing (and especially when we're new), we run the Django development server on the local machine, not an a EC2 instance or anywhere else. You will be less confused if you do that, and you will have fewer problems.

Regards,

Antonis

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7643c462-97bf-479d-90a0-302a10255470n%40googlegroups.com.

Django-Admin

unread,
Jun 22, 2022, 1:48:48 PM6/22/22
to Django users
Try opening the link in a browser in the same EC2 instance, if you are not doing so.

Paul Kudla (SCOM.CA Internet Services Inc.)

unread,
Jun 23, 2022, 8:34:17 AM6/23/22
to django...@googlegroups.com

ok this is networking 101 stuff

if the server is running on 127.0.0.1 8000 (or whatever port)

and you are trying to access from another system you need to use the ip
address of the server (not 127.0.0.1) and it needs to be accesable on
your network to be able to find it.

best to try telneting to the server as a test to verify ip & ports are
correct.

example :

telnet 192.168.0.2<ipaddress> <space> 8000 <port> for example if you get
a response then you are good to go.

ie

"telnet 192.168.0.2 8000"





Happy Thursday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email pa...@scom.ca
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/dfe8f847-65bc-4602-b3b9-9e7a81998459n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/dfe8f847-65bc-4602-b3b9-9e7a81998459n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
Reply all
Reply to author
Forward
0 new messages