rduplain/flask-script — Issue #24: Distribute entry points
Author: rduplain
Created: 2012-02-07 18:00:11+00:00
State: open

I like to keep the manager in my app package and use distribute entry points:

# myapp/manage.py
def main():
manager.run()

# setup.py
entry_points={
'console_scripts': [
'myappctl = myapp.manage:main',
],
},

The downside is that it relies on distribute and for your app to be installed or pseudoinstalled (developer mode) but the upside is that it lets your app actually work like a proper distributable package, not relying on being in the source directory or even even having the source directory. Just install and use myappctl. I also like having code related to my package //in// my actual package.

Often you might just have development stuff in your manage.py but maybe you have deployment stuff such as creating tables in a database etc. This way you can just put an sdist with fabric, easy_install it and your manager is just there.

Maybe this method should be documented as an alternative?

//(Even without entry points, this still lets you do `python -m myapp.manage` outside of the source dir or `python myapp/manage.py` inside it.)

---------------------------------------
- Bitbucket: https://bitbucket.org/danjac/flask-script/issue/18
- Originally Reported By: Dag Odenhall
- Originally Created At: 2010-10-22 18:32:12