Opened 2 years ago

Last modified 2 years ago

#30003 closed Cleanup/optimization entry point — at Version 1

Reported by: James Pic Owned by: nobody
Component: Core (Management commands) Version: 2.1
Severity: Normal Keywords:
Cc: James Pic Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by James Pic)

Currently, executes in an

if __name__ == '__main__':


While this might work when declaring as script in, a popular convention is to use the entry_point feature of

To add support for entry_point in 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, will also work as entry_point with yourproject.manage:main and using 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.

Change History (1)

comment:1 Changed 2 years ago by James Pic

Cc: James Pic added
Description: modified (diff)
Has patch: set
Type: UncategorizedNew feature
Note: See TracTickets for help on using tickets.
Back to Top