Hey, #Python and #Django folks…I’m new to Django and returning to Python after y...
Ryan Kennedy @rckenned@hachyderm.io
Hey, #Python and #Django folks…I’m new to Django and returning to Python after years away (previously having only worked in 2.x and never in Django). I come from a typed languages background, so the new typing support in 3.x has really been handy for me to make that transition.
However, Django settings. They’re all untyped, right? If I access django.conf.settings.MY_SETTING, there’s no type to it that the type checker can see. Subsequently, ty (the type checker I’m using) very unhelpfully did not notify me that I was passing a string (my configuration setting, the name of a DynamoDB table) instead of an object (the actual boto3 Table object). As a result, type error explosion on contact with production.
This isn’t necessarily just a Django problem, but the untyped settings have exacerbated it (it’s happened twice, both times with something coming out of Django settings).
What’s the right way to handle this in Python/Django?
I’m used to my good ‘ole @dropwizard, where our configurations are both typed and validated. I miss that.