I'm looking for a way to override/define some individual django setting from command line without additional settings files.
What I need right now is to set the DEBUG setting or logging level each time when I run my management command. But it would be nice to be able to set anything.
If you want to connect through TCP sockets, set HOST to 'localhost' or '127.0.0.1' ('host' lines in pg_hba.conf ).
Django-admin.py: It is a Django's command line utility for administrative tasks. Manage.py: It is an automatically created file in each Django project. It is a thin wrapper around the Django-admin.py.
In settings.py you can check for command line arguments, like this:
import sys
# for testing
if "--enable-wiki" in sys.argv:
ENABLE_WIKI = True
sys.argv.remove("--enable-wiki")
Usage:
./manage.py test --enable-wiki MyApp.tests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With