Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#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)

manage.py (1.6 KB ) - added by phil.h.smith@… 18 years ago.
pseudo code for overriding execute_manager to add custom ./manage.py actions

Download all attachments as: .zip

Change History (8)

comment:1 by phil.h.smith@…, 18 years ago

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.

by phil.h.smith@…, 18 years ago

Attachment: manage.py added

pseudo code for overriding execute_manager to add custom ./manage.py actions

comment:2 by Ronny Pfannschmidt <ronny.pfannschmidt@…>, 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:3 by ramiro <rm0 _at_ gmx.net>, 18 years ago

See #2868

in reply to:  3 comment:4 by anonymous, 18 years ago

Triage Stage: UnreviewedDesign decision needed

#2868 is about project level scripts, this ticket about application level scripts, so it's not a duplicate.

comment:5 by mir@…, 18 years ago

Last comment was from me, sorry.

comment:6 by Malcolm Tredinnick, 18 years ago

Resolution: wontfix
Status: newclosed

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 Jacob, 17 years ago

Reporter: changed from Ronny Pfannschmidt <ronny.pfannschmidt@…> to Ronny Pfannschmidt
Note: See TracTickets for help on using tickets.
Back to Top