tomdyson / wagalytics

A Google Analytics dashboard in your Wagtail admin
MIT License
217 stars 42 forks source link

Fail hard if relevant settings are not available #5

Open mx-moth opened 8 years ago

mx-moth commented 8 years ago

In the Readme, under TODO:

fail gracefully if the relevant settings aren't available

I suggest instead failing hard if the required settings are not available, by throwing an error as part of a Django app check. Missing settings are a configuration error that should be visible at the time of configuration. Failing softly later when a user browses to the analytics page leaves that user with no way of fixing it besides contacting the system administrator who forgot to add the settings in the first place.

tomdyson commented 8 years ago

Thanks, @timheap, you're right, of course!

tomdyson commented 8 years ago

note to self:

from django.conf import settings

if not hasattr(settings, 'GA_KEY_FILEPATH'):
   # error
if not hasattr(settings, 'GA_VIEW_ID'):
   # error