system logging. • Application Logs vs. Other Logs • App logs: any log file containing data logged from your Python web application • Why Bother With Logging? • debug, tracking, security… 4
another module, don’t import and reuse a logger from elsewhere. Instead, define a new logger specific to the module. • What this gives you is the ability to turn on and off only the specific loggers that you currently need. 13
manage.py raven test ~demo~ 16 # settings.py # ... # Set your DSN value RAVEN_CONFIG = { 'dsn': 'SENTRY_DSN', } # Add raven to the list of installed apps INSTALLED_APPS = INSTALLED_APPS + ( # ... 'raven.contrib.django.raven_compat', )
important messages at a glance. Ex: logutils • loggly.com (http://loggly.com/) simplifies log management and provides excellent query tools. • PagerDuty (http://www.pagerduty.com/) alert you and your team repeatedly until you’ve taken action. 17
changes to more than one model. • You want to dispatch the same signal from multiple apps and have them handled the same way by a common receiver. • You want to invalidate a cache after a model save. • You have an unusual scenario that needs a callback, and there’s no other way to handle it besides using a signal. 25
model and can be moved into one of that model’s methods, possibly called by save(). • The signal can be replaced with a custom model manager method. • The signal relates to a particular view and can be moved into that view. 26