I'm working on a Flask-Script extension:
http://bitbucket.org/danjac/flask-script
This is intended to make it easy to use Flask with external scripts.
It works like this:
# manage.py
from flask import Flask
from flaskext.script import Command, Manager
from myapp import app
manager = Manager(app)
class SayHello(Command):
def run(self, app, name):
print "hello", name
manager.register("hello", SayHello())
if __name__ == "__main__":
manager.run()
>>> python manage.py hello world
.... "hello world"
Support for a Flask shell and runserver are included, as well as help
support and option parsing functionality.
This is at a very early stage, so do not assume working or stable
code. However I would like to get some feedback on what people might
want from a scripting extension, so any input welcome. If anyone has a
logo or an idea for a logo that would also be welcome.
Very useful. Great !! Stephane On 07/05/2010 01:02 PM, Dan Jacob wrote: > I'm working on a Flask-Script extension: > > http://bitbucket.org/danjac/flask-script > > This is intended to make it easy to use Flask with external scripts. > It works like this: > > # manage.py > > from flask import Flask > from flaskext.script import Command, Manager > > from myapp import app > > manager = Manager(app) > > class SayHello(Command): > > def run(self, app, name): > print "hello", name > > manager.register("hello", SayHello()) > > if __name__ == "__main__": > manager.run() > >>>> python manage.py hello world > .... "hello world" > > Support for a Flask shell and runserver are included, as well as help > support and option parsing functionality. > > This is at a very early stage, so do not assume working or stable > code. However I would like to get some feedback on what people might > want from a scripting extension, so any input welcome. If anyone has a > logo or an idea for a logo that would also be welcome.
Very good work! We can add message queue to Flask and use this to start the MQ server .
I suppose you would rather use Celery for that, as it's no longer Django-specific. On 5 July 2010 12:14, 何威威 <heww0205@gmail.com> wrote: > Very good work! We can add message queue to Flask and use this to start the > MQ server . >
Hi, On 7/5/10 1:16 PM, Dan Jacob wrote: > I suppose you would rather use Celery for that, as it's no longer > Django-specific. Unfortunately Celery makes the same mistake Django does and has a process wide configuration. Does not mean it cannot be used with Flask of course, but I find that quite frustrating to see. Regards, Armin
What about beanstalkd? http://kr.github.com/beanstalkd/ 2010/7/5 Armin Ronacher <armin.ronacher@active-4.com> > Hi, > > On 7/5/10 1:16 PM, Dan Jacob wrote: > > I suppose you would rather use Celery for that, as it's no longer > > Django-specific. > Unfortunately Celery makes the same mistake Django does and has a > process wide configuration. Does not mean it cannot be used with Flask > of course, but I find that quite frustrating to see. > > > Regards, > Armin >
Oh, thanks your suggestion. Celery looks like wonderful. 2010/7/5 Dan Jacob <danjac354@gmail.com> > I suppose you would rather use Celery for that, as it's no longer > Django-specific. > > On 5 July 2010 12:14, 何威威 <heww0205@gmail.com> wrote: > > Very good work! We can add message queue to Flask and use this to start > the > > MQ server . > > >