[Answered ]-Why I can't open any port when I deploy my django on my server, but my test program can run on my own machine

2👍

Two things.

Firstly, as the documentation explains, by default runserver only binds to the localhost interface, which means it is only available on a browser running on the same machine. To get it to be visible outside the local machine, you need to bind to an externally-visible address, or 0.0.0.0 for all addresses:

python manage.py runserver 0.0.0.0:8080

Secondly, as the documentation also explains, you should not be trying to use the development server in a production setting anyway. Use a proper webserver, eg Apache + mod_wsgi.

Leave a comment