Get the path to Django itself
- by andybak
I've got some code that runs on every (nearly) every admin request but doesn't have access to the 'request' object.
I need to find the path to Django installation. I could do:
import django
django_path = django.__file__
but that seems rather wasteful in the middle of a request.
Does putting the import at the start of the module waste memory? I'm fairly sure I'm missing an obvious trick here.