Run Django on multiple ports

后端 未结 3 966
一生所求
一生所求 2021-02-10 15:50

Could someone tell me how I can run Django on two ports simultaneously? The default Django configuration only listens on port 8000. I\'d like to run another instance on port xxx

3条回答
  •  别跟我提以往
    2021-02-10 16:55

    Just run two instances of ./manage.py runserver. You can set a port by simply specifying it directly: ./manage.py runserver 8002 to listen on port 8002.

    Edit I don't really understand why you want to do this. If you want two servers serving different parts of your site, then you have in effect two sites, which will need two separate settings.py and urls.py files. You'd then run one instance of runserver with each, passing the settings flag appropriately: ./manage.py runserver 8002 --settings=app1.settings

提交回复
热议问题