Get the path to Django itself

Posted by andybak on Stack Overflow See other posts from Stack Overflow or by andybak
Published on 2010-05-16T19:26:40Z Indexed on 2010/05/16 19:30 UTC
Read the original article Hit count: 231

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about django

Related posts about python