Code

Opened 6 years ago

Closed 6 years ago

#6013 closed (duplicate)

management.find_commands makes distribute django app difficultly.

Reported by: bear330 Owned by: jdetaeye
Component: Core (Other) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

django.core.management.find_commands only searches the commands that ends with .py, but if I want to distribute django application to others and don't want to distribute source code, this will be a barrier.

Actually, I want to distribute my django application using py2exe to be a desktop application.

My approach in this time is:

import django.core.management


def find_commands(management_dir):

command_dir = os.path.join(management_dir, 'commands')
try:

return [f[:-4] for f in os.listdir(command_dir)

if not f.startswith('_') and f.endswith('.pyo')]

except OSError:

return []


django.core.management.find_commands = find_commands


from django.core.management import ProjectManagementUtility
os.environDJANGO_SETTINGS_MODULE? = 'settings'
utility = ProjectManagementUtility(sys.argv, executableDir)
utility.execute()

It looks silly.
If django.core.management.find_commands can search .py, .pyc and .pyo, I don't need to this anymore.

This will make distribute django more easily and more flexible.

Thanks for your effort.

Attachments (0)

Change History (6)

comment:1 in reply to: ↑ description Changed 6 years ago by bear330

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Sorry about that, the source code in middle of this ticket is broken because I forget to format it as code block.

Unfortunately, I don't know how to edit it... :p

comment:2 Changed 6 years ago by jdetaeye@…

See also ticket #5825 for the very same concern around custom commands.

comment:3 Changed 6 years ago by anonymous

  • Owner changed from nobody to jdetaeye

comment:4 Changed 6 years ago by jdetaeye@…

bear330: I attached a patch on ticket 5825. Feel free to give it a try!

comment:5 Changed 6 years ago by blp@…

Thanks :)

comment:6 Changed 6 years ago by Simon G <dev@…>

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

Duplicate of #5825

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.