User:Mjzffr/Resources

From MozillaWiki
Jump to: navigation, search

Resources (Possibly out-of-date)

These links and wisdom were collected during my work on One and Done during Summer 2014. It may be useful to future contributors. Maybe it can be moved to a Developer Resources page in the One and Done section of the wiki.

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)