0

Why can't I run python manage.py runserver on all ports?

I understand this is probably a newbie question, but what prevents me from achieving this?

I would like to access my app without having to include the port, like a regular website

Mojimi
  • 2,561
  • 9
  • 52
  • 116
  • "[What is a tcp port?](https://en.wikipedia.org/wiki/Port_(computer_networking))" – spectras Jun 05 '17 at 19:40
  • Even if it were possible, there are up to 65,535 ports on a computer. You'll actually run `python manage.py runserver` on each one of them? – Zero Jun 05 '17 at 19:51
  • I purposedely made the title very "newbieish" in case other people have the same question, the actual question would be how to access django without a port – Mojimi Jun 05 '17 at 19:53
  • So how do you want to access your Django app? Without a port, as in "localhost" or "www.example.com"? – Zero Jun 05 '17 at 20:00
  • The development server is not supposed to be run in production. So you don't need to know this. – e4c5 Jun 05 '17 at 23:48

2 Answers2

4

WARNING - Do not run the test server in production!

The reason you have to type in the port when connecting to the test server is because it doesn't run on a standard web port being "http: 80 and https: 443". If you use the command below it will not require the port number be provided when connecting to the test server. Keep in mind that you will need root or sudo access and if something is already running on port 80 it will fail.

Runserver with port: python manage.py runserver -p 80

SudoKid
  • 439
  • 4
  • 14
1

Just run it on port 80 and you won't have to specify the port.

You can't blast it on all other ports because many, many other services already use those other ports. Network services need to have ports specified.

Ivan
  • 1,427
  • 1
  • 16
  • 26