#3528 closed (wontfix)
simple cli extensions for django-admin.py and manage.py
Reported by: | Ronny Pfannschmidt | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Design decision needed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
just ran across the point where its nice to have custom commands for the cli
it would simplify setting up daily actions and other tasks wich arent well-suited for the web interface
it would be nice to have something like
./manage.py run $myapp $mycommand $myargs ## examples ./manage.py run sessions clean ./manage.py run notifications daily ./manage.py run forum update post_cache
Attachments (1)
Change History (8)
comment:1 by , 18 years ago
by , 18 years ago
pseudo code for overriding execute_manager to add custom ./manage.py actions
comment:2 by , 18 years ago
nice method, but it's on project basis
usually applications need the custom commands, not projects (wich are just combinations of applications)
comment:4 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
#2868 is about project level scripts, this ticket about application level scripts, so it's not a duplicate.
comment:6 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
All manage.py does is set DJANGO_SETTINGS_MODULE in the environment and puts the current project is on the path. So it's trivial to replicate that for scripts you want to run -- like literally one line.
It doesn't make sense to think of manage.py on a per-app level, outside of projects, because settings files are on a project level. If your apps aren't all under one project, you need to set the Python paths manually yourself anyway so that they are accessible (if not on default paths), so manage.py doesn't help you there.
This isn't worth implementing because it doesn't really make anything easier than it already is.
comment:7 by , 17 years ago
Reporter: | changed from | to
---|
We worked out a sketch of how to try this in the irc (see attachment.) We found we had to duplicate django.core.management.execute_manager so we could customize action_mapping before passing to execute_from_command_line.
There seem to be some ways to make this happier and drier. The one that seems cleanest to me is to give execute_manager a default-able action_mapping parameter that would augment and/or replace the default one. Another is to remove the startapp/startproject magic from it (leaving it basically empty) so we don't feel bad duplicating 'n overriding.