Login

3rd Party App Directories

Author:
thalin
Posted:
June 30, 2008
Language:
Python
Version:
.96
Score:
-2 (after 6 ratings)

How to make this work:

  • Put the code into your settings.py (or even better, local_settings.py if you have one)
  • Put 3rd party apps you'd like to use into the directories specified in APP_DIRS.
  • Place 'appname', into INSTALLED_APPS.

Just a little trick I use to keep from having to install apps via setup.py; I can just stick apps into arbitrary locations and use them. I also do this to keep single copies of 3rd party apps I use in multiple projects (but again without installing to the global python path). No idea if this is bad practice or anything, but I find it useful.

1
2
3
4
5
6
7
8
9
APP_DIRS = (
    # Put strings here like '/home/html/project/apps'
    # Pretty much just like TEMPLATE_DIRS.
)

import sys

for app_dir in APP_DIRS:
    sys.path.insert(0, app_dir)

More like this

  1. Template tag - list punctuation for a list of items by shapiromatron 3 months, 1 week ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 3 months, 2 weeks ago
  3. Serializer factory with Django Rest Framework by julio 10 months, 1 week ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 11 months ago
  5. Help text hyperlinks by sa2812 11 months, 3 weeks ago

Comments

pgugged (on June 30, 2008):

Hey

really useful little snippet!

I just don't like the setup.py thingie :)

#

Please login first before commenting.