For example the Python decimal.Decimal() class has a context. You can view the current context with getcontext() and set new values for precision, rounding, or enable traps.
If you wanted to set a new value for the context so this is visible throughout a Django project, where would be best to do so?
e.g. Throughout the project the FloatOperation signal should be trapped.
from decimal import FloatOperation, getcontext
context = getcontext()
context.traps[FloatOperation] = True
Also using getcontext() return the current context for the active thread. Aside from explicitly creating new threads in a project, are there any additional consideration to make with Django creating additional threads.
I'd suggest an application core, or common, that includes your setup as part of AppConfig.ready().
https://docs.djangoproject.com/en/1.7/ref/applications/#django.apps.AppConfig.ready
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With