Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#357 closed enhancement (fixed)

[patch]: needs a --projects parameter

Reported by: hugo <gb@…> Owned by: Adrian Holovaty
Component: Core (Management commands) Version:
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


this parameter is to add stuff to the sys.path environment, so people don't need to either use admin rights to link their projects directory to some python path or use the PYTHONPATH environment variable.

Index: bin/
--- bin/ (revision 535)
+++ bin/ (working copy)
@@ -52,11 +52,15 @@
     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('--projects',
+        help='Python path to projects directory, e.g. where myproject of "myproject.settings.main" resides. If this isn\'t provided, the PYTHONPATH environment variable will be used.')
     options, args = parser.parse_args()
     # Take care of options.
     if options.settings:
         os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
+    if options.projects:
+        sys.path.insert(0, options.projects)
     # Run the appropriate action. Unfortunately, optparse can't handle
     # positional arguments, so this has to parse/validate them.

Change History (4)

comment:1 Changed 14 years ago by hugo <gb@…>

this ticket references #248*, too

comment:2 Changed 14 years ago by aCC

Good idea.

comment:3 Changed 14 years ago by Adrian Holovaty


comment:4 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [793]) Fixed #357 -- Added a '--pythonpath' option to django-admin. Thanks for the patch, Hugo

Note: See TracTickets for help on using tickets.
Back to Top