Opened 16 years ago

Closed 16 years ago

Last modified 12 years ago

#8458 closed (worksforme)

adding own commands to manage.py not working correctly

Reported by: dafire Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I tried to add my own commands as described in http://www.djangoproject.com/documentation/django-admin/ but it did not find my commands.

I did some research and found a problem.

lets assume I have

INSTALLED_APPS = (
  'proj.app'
)

and call manage.py from the /var/www/proj folder it looks for the "management" class in /var/www/proj/proj/app/management

I added sys.path = ['..']+sys.path to "django\core\management\__init__.py" as a local fix and it worked after that.

Change History (6)

comment:1 by anonymous, 16 years ago

Resolution: duplicate
Status: newclosed

This is almost certainly a duplicate of #5825 which is fixed but apparently not checked in yet.

comment:2 by Russell Keith-Magee, 16 years ago

Resolution: duplicate
Status: closedreopened

How on earth can a bug be fixed if the fix hasn't been checked in? This is a new bug (or at least a new manifestation of an old one).

comment:3 by Malcolm Tredinnick, 16 years ago

milestone: 1.0
Triage Stage: UnreviewedAccepted

in reply to:  description ; comment:4 by anonymous, 16 years ago

Component: Uncategorizeddjango-admin.py
Resolution: worksforme
Status: reopenedclosed

Replying to dafire:

I tried to add my own commands as described in http://www.djangoproject.com/documentation/django-admin/ but it did not find my commands.

I did some research and found a problem.

[snipped]

and call manage.py from the /var/www/proj folder it looks for the "management" class in /var/www/proj/proj/app/management

Looks like you are misinterpreting the docs. You need to create a folder called "management" in your app and in it create an empty __init__.py alongwith a sub-folder called "commands". Each command will have a separate file and will be under the "commands" folder. Also remember to create another empty __init__.py file in the commands folder. Each command file should contain a class "Command" that should override a method "handle" that does whatever you want when the command is invoked.

The command tree should look something like this:

proj/
  settings.py
  app/
    models.py
    management/
       __init__.py
       commands/
          __init__.py
          mycommand.py

Please reopen the ticket if I've got something wrong with what you meant to convey.

in reply to:  4 comment:5 by Thejaswi Puthraya, 16 years ago

Replying to anonymous:
[snipped]
Oops...the previous replier was me :)

comment:6 by Jacob, 12 years ago

milestone: 1.0

Milestone 1.0 deleted

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