How change database's port dynamically(django)

i have a django project that it should have ability to change the database's port dynamically for security reasons.

for example there should be a template like ( port= ) and the administrator should enter a port and change the default one. how to do this?


If you are using SQLite database which comes embedded in Django by default so in order to change the database port you have to change the run server port of Django also.

You can add these mentioned below lines in your file

from server import Command as run server runserver.default_port="8001"

Back to Top