django-autodeps /

Filename Size Date modified Message
32 B
183 B
35.1 KB
2.7 KB
428 B

Manage external dependencies hosted through any version control system. Installation

Download and add it to your PYTHONPATH

Setup Add DEPENDENCIES to your settings file

  • If you're migrating from using svn:externals, there is a script you can use to automatically generate the list of dependencies. Just run the following command, copy/paste the output into your settings file, and make sure your INSTALLED_APPS is up to date: apps/external_apps libs/external_libs

  • If you're not migrating from svn:externals, you can set your DEPENDENCIES and INSTALLED_APPS manually like this:

    import os import deps # ... PROJECT_PATH = os.path.abspath('%s' % path.dirname(__file__)) # ... DEPENDENCY_ROOT = os.path.join(PROJECT_PATH, 'external') DEPENDENCIES = (

    # subversion deps.SVN(

    '', root=DEPENDENCY_ROOT,

    ), # mercurial deps.HG(

    '', app_name='robots', root=DEPENDENCY_ROOT,


    ) # ... INSTALLED_APPS = (

    # ... 'robots',



  • To dynamically add the dependencies to your python path, add this code to AFTER importing settings but BEFORE importing anything from Django:

    import deps deps.add_all_to_path(projectname.settings, auto_update=sys.argv[1] == 'up')

For example, a complete might look like this:

#!/usr/bin/env python

import sys import os.path import deps

# remove '.' from the path (you should use the project package to reference # anything in here) sys.path.pop(0) PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.dirname(PROJECT_ROOT))

import projectname.settings
except ImportError:
import sys sys.stderr.write("Error: Can't find the file '' in the directory containing %r. It appears you've customized things.nYou'll have to run, passing it your settings module.n(If the file does indeed exist, it's causing an ImportError somehow.)n" % __file__) sys.exit(1)
if len(sys.argv) > 1 and sys.argv[1] == 'up':
deps.add_all_to_path(projectname.settings, auto_update=True)
deps.add_all_to_path(projectname.settings, auto_update=False)

from import execute_manager if __name__ == "__main__":

  • Now you can run "./ up" to grab the dependencies!