From c8930e3af441c68973e96b0afc0361357365bb0d Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Thu, 6 Oct 2005 17:22:23 +0000 Subject: [PATCH] Fixed #357 -- Added a '--pythonpath' option to django-admin. Thanks for the patch, Hugo git-svn-id: http://code.djangoproject.com/svn/django/trunk@793 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/bin/django-admin.py | 4 ++++ docs/django-admin.txt | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/django/bin/django-admin.py b/django/bin/django-admin.py index 31af89dae5..0d021ba172 100755 --- a/django/bin/django-admin.py +++ b/django/bin/django-admin.py @@ -53,11 +53,15 @@ def main(): parser = DjangoOptionParser(get_usage()) parser.add_option('--settings', help='Python path to settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.') + parser.add_option('--pythonpath', + help='Lets you manually add a directory the Python path, e.g. "/home/djangoprojects/myproject".') options, args = parser.parse_args() # Take care of options. if options.settings: os.environ['DJANGO_SETTINGS_MODULE'] = options.settings + if options.pythonpath: + sys.path.insert(0, options.pythonpath) # Run the appropriate action. Unfortunately, optparse can't handle # positional arguments, so this has to parse/validate them. diff --git a/docs/django-admin.txt b/docs/django-admin.txt index b4b07f4f12..188dd4295c 100644 --- a/docs/django-admin.txt +++ b/docs/django-admin.txt @@ -193,6 +193,16 @@ Explicitly specifies the settings module to use. The settings module should be in Python path syntax, e.g. "myproject.settings.main". If this isn't provided, ``django-admin.py`` will use the DJANGO_SETTINGS_MODULE environment variable. +--pythonpath +============ + +Example usage:: + + django-admin.py init --pythonpath='/home/djangoprojects/myproject' + +Adds the given filesystem path to the Python path. If this isn't provided, +``django-admin.py`` will use the ``PYTHONPATH`` environment variable. + --help ======