jonny jonny - 4 months ago 82
Python Question

django change default runserver port

I would like to make the default port that

manage.py runserver
listens on specifiable in an extraneous
config.ini
. Is there an easier fix than parsing
sys.argv
inside
manage.py
and inserting the configured port?

The goal is to run
./manage.py runserver
without having to specify address and port every time but having it take the arguments from the
config.ini
.

Answer

create a bash script with the following:

#!/bin/bash
exec ./manage.py runserver 0.0.0.0:<your_port>

save it as runserver in the same dir as manage.py

chmod +x runserver

and run it as

./runserver
Comments