Confirmed users
378
edits
mNo edit summary |
(→Resources: add instructions about logging) |
||
| Line 9: | Line 9: | ||
* [https://docs.djangoproject.com/en/dev/howto/initial-data/ Providing initial model data]: good to know if your local project database is empty. | * [https://docs.djangoproject.com/en/dev/howto/initial-data/ Providing initial model data]: good to know if your local project database is empty. | ||
* [https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-display/ Class-based generic views in Django] | * [https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-display/ Class-based generic views in Django] | ||
=== Set up logging === | |||
In `oneanddone\settings\local.py` uncomment the assignment to `LOGGING` and add `import logging` above it, like so: | |||
import logging | |||
LOGGING = dict(loggers=dict(playdoh={'level': logging.DEBUG})) | |||
This defines a logger called 'playdoh'. | |||
As a result, your own debug messages will be displayed among the other messages shown when `python manage.py runserver` is running. Example: | |||
# views.py | |||
import logging | |||
log = logging.getLogger('playdoh') | |||
def myview(request): | |||
# ... | |||
# print to the console | |||
log.debug('%s got here' % request.user) | |||