Django

Code

Ticket #6013 (closed: duplicate)

Opened 3 years ago

Last modified 3 years ago

management.find_commands makes distribute django app difficultly.

Reported by: bear330 Assigned to: jdetaeye
Milestone: Component: Core framework
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

Change History

(in reply to: ↑ description ) 11/22/07 09:17:11 changed by bear330

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

11/23/07 00:47:45 changed by jdetaeye@frepple.com

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

11/26/07 11:34:00 changed by anonymous

  • owner changed from nobody to jdetaeye.

11/26/07 11:55:37 changed by jdetaeye@frepple.com

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

11/27/07 20:20:27 changed by blp@alumni.nccu.edu.tw

Thanks :)

12/01/07 21:58:52 changed by Simon G <dev@simon.net.nz>

  • status changed from new to closed.
  • resolution set to duplicate.

Duplicate of #5825


Add/Change #6013 (management.find_commands makes distribute django app difficultly.)




Change Properties
Action