-
Notifications
You must be signed in to change notification settings - Fork 42
23 Settings and debug toolbar
Currently users can log themselves out using the link in the top right. If you want to automatically have users logged out when they close their browser you can add this line to the elevennote/settings.py
file:
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
Since the settings file is written in Python you can write Python code to access settings.
Also, the settings file can be imported and accessed from views (or other code) to conditionalize based on settings:
from django.conf import settings
if settings.DEBUG:
# Do something
More documentation on settings: https://docs.djangoproject.com/en/1.8/topics/settings/
List of all settings: https://docs.djangoproject.com/en/1.8/ref/settings/
The Django debug toolbar is an add-on that runs in the browser when the server's Debug=True
setting is on. (Note: never run with Debug=True on production!)
$ pip install django-debug-toolbar
In elevennote/settings.py
add this line into the INSTALLED_APPS
.
'debug_toolbar',
If the server is running in debug mode the browser will include a useful sidebar that includes information such as
- Request headers
- All DB queries
- Timing information
- What template and view are being used
- And much more