82👍
from django.conf import settings
dir(settings)
and then choose attribute from what dir(settings)
have shown you to say:
settings.name
where name
is the attribute that is of your interest
Alternatively:
settings.__dict__
prints all the settings. But it prints also the module standard attributes, which may somewhat clutter the output.
86👍
I know that this is an old question, but with current versions of django (1.6+), you can accomplish this from the command line the following way:
python manage.py diffsettings --all
The result will show all of the settings including the defautls (denoted by ### in front of the settings name).
- [Django]-Is there a naming convention for Django apps
- [Django]-How can I use the variables from "views.py" in JavasScript, "<script></script>" in a Django template?
- [Django]-Django required field in model form
20👍
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))
- [Django]-Setting the selected value on a Django forms.ChoiceField
- [Django]-How to delete project in django
- [Django]-Remove pk field from django serialized objects
15👍
To show all django settings (including default settings not specified in your local settings file):
from django.conf import settings
dir(settings)
- [Django]-Running a specific test case in Django when your app has a tests directory
- [Django]-Django 1.7 – makemigrations not detecting changes
- [Django]-Get protocol + host name from URL
3👍
In your shell, you can call Django’s built-in diffsettings:
from django.core.management.commands import diffsettings
output = diffsettings.Command().handle(default=None, output="hash", all=False)
- [Django]-Is it secure to store passwords as environment variables (rather than as plain text) in config files?
- [Django]-Removing 'Sites' from Django admin page
- [Django]-Error when using django.template