Skip to content
Browse files

Fixed #357 -- Added a '--pythonpath' option to django-admin. Thanks f…

…or the patch, Hugo

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 485042b commit c8930e3af441c68973e96b0afc0361357365bb0d @adrianholovaty adrianholovaty committed
Showing with 14 additions and 0 deletions.
  1. +4 −0 django/bin/
  2. +10 −0 docs/django-admin.txt
4 django/bin/
@@ -53,11 +53,15 @@ def main():
parser = DjangoOptionParser(get_usage())
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.
10 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,
```` will use the DJANGO_SETTINGS_MODULE environment variable.
+Example usage::
+ init --pythonpath='/home/djangoprojects/myproject'
+Adds the given filesystem path to the Python path. If this isn't provided,
+```` will use the ``PYTHONPATH`` environment variable.

0 comments on commit c8930e3

Please sign in to comment.
Something went wrong with that request. Please try again.