How do I print out the contents of my settings in a django shell?

后端 未结 5 1083
不思量自难忘°
不思量自难忘° 2021-01-30 12:41

When I run python manage.py shell, I can print out the python path

>>> import sys
>>> sys.path

What should I typ

5条回答
  •  忘了有多久
    2021-01-30 13:44

    In case a newbie stumbles upon this question wanting to be spoon fed the way to print out the values for all settings:

    def show_settings():
        from django.conf import settings
        for name in dir(settings):
            print(name, getattr(settings, name))
    

提交回复
热议问题