#30003: Manage.py entry point
-------------------------------------+-------------------------------------
     Reporter:  James Pic            |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Core (Management     |                  Version:  2.1
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by James Pic:

Old description:

> Currently, manage.py-tpl executes in an
> {{{
> if __name__ == '__main__':
> }}}
>  block.
>
> While this might work when declaring manage.py as script in setup.py, a
> popular convention is to use the entry_point feature of setup.py.
>
> To add support for entry_point in manage.py-tpl we only need to move the
> code from the if block into a new function ie. main() and call in it in
> the if-block.
>
> Then, manage.py-tlp will also work as entry_point with
> yourproject.manage:main and using manage.py as script will also still
> work.
>
> This removes a manual effort every time a project is used by a follower
> of the entry_point convention, without causing any issue for regular
> users.

New description:

 Currently, manage.py-tpl executes in an
 {{{
 if __name__ == '__main__':
 }}}
  block.

 While this might work when declaring manage.py as script in setup.py, a
 popular convention is to use the console_scripts entry_point in setup.py
 to define commands.

 For manage.py-tpl to support console_scripts entry_point we only need to
 move the code from the if block into a new function ie. main(), then call
 main() it in the if-block.

 Then, manage.py-tlp will also work as console_scripts entry_point with
 yourproject.manage:main, and using manage.py as script will also still
 work.

 This removes a manual effort every time a project defines a
 console_scripts entry_point for the management CLI, without having to set
 DJANGO_SETTINGS_MODULE.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30003#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.18ebc486d82297b18fc6b5745b2fc83c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to