Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#357 closed enhancement (fixed)

[patch]: django-admin.py needs a --projects parameter

Reported by: hugo <gb@…> Owned by: adrian
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: UI/UX:

Description

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/django-admin.py
===================================================================
--- bin/django-admin.py (revision 535)
+++ bin/django-admin.py (working copy)
@@ -52,11 +52,15 @@
     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('--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.

Attachments (0)

Change History (4)

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

this ticket references #248*, too

comment:2 Changed 9 years ago by aCC

Good idea.

comment:3 Changed 9 years ago by adrian

  • Component changed from Tools to django-admin.py

comment:4 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.