Hey everybody, Some idea I had a while back but not the time to actually implement it: what about a Flask-Servers extension that provides commands to run the application on all kinds of servers. It could run it on CherryPy, gunicorn, the builtin one and maybe even go as far as providing a command that spits out mod_wsgi configs that you can pipe into a file and just include. If someone is interested in doing that, why not pick up that idea? Regards, Armin
On 1 September 2010 12:19, Armin Ronacher <armin.ronacher@active-4.com> wrote: > Hey everybody, > > Some idea I had a while back but not the time to actually implement it: > what about a Flask-Servers extension that provides commands to run the > application on all kinds of servers. > > It could run it on CherryPy, gunicorn, the builtin one and maybe even go > as far as providing a command that spits out mod_wsgi configs that you > can pipe into a file and just include. > > If someone is interested in doing that, why not pick up that idea? > > > Regards, > Armin > Hi everyone, I wrote this a while back which does something similar for server launching without the flask command support, it may be of help to anyone taking on this extension: http://bitbucket.org/aafshar/wsgid-main/overview with support for these servers: http://bitbucket.org/aafshar/wsgid-main/src/tip/wsgid/servers/
Hi, Another thing. Thinking about it another nice thing to have would be a plugin for fabric that can one-command deploy and setup new virtualenvs on a server and deploy the latest version of a Flask application. Regards, Armin
On 09/01/2010 01:40 PM, Armin Ronacher wrote: > Hi, > > Another thing. > > Thinking about it another nice thing to have would be a plugin for > fabric that can one-command deploy and setup new virtualenvs on a server > and deploy the latest version of a Flask application. > > > Regards, > Armin Yes, I approve with this point. why not in the setup.py ? We can create a specific command in setup.py to upload to the server via ssh and use a specific configuration file (txt or py)
setup.py would be more consistent (Flask-Script is more for actually running app functionality, than deployment) On 1 September 2010 12:45, Stephane Wirtel <stephane@wirtel.be> wrote: > On 09/01/2010 01:40 PM, Armin Ronacher wrote: >> Hi, >> >> Another thing. >> >> Thinking about it another nice thing to have would be a plugin for >> fabric that can one-command deploy and setup new virtualenvs on a server >> and deploy the latest version of a Flask application. >> >> >> Regards, >> Armin > Yes, I approve with this point. > > why not in the setup.py ? > > We can create a specific command in setup.py to upload to the server via ssh and use a specific configuration file (txt or py) >
A bit like Ian Bicking's toppcloud: http://blog.ianbicking.org/2010/02/10/why-toppcloud-not-agnostic/ Maybe Flask-Deploy might be a better name, which could include the server options ? Just a thought. On 1 September 2010 12:40, Armin Ronacher <armin.ronacher@active-4.com> wrote: > Hi, > > Another thing. > > Thinking about it another nice thing to have would be a plugin for > fabric that can one-command deploy and setup new virtualenvs on a server > and deploy the latest version of a Flask application. > > > Regards, > Armin >
Hi, On 2010-09-01 1:44 PM, Dan Jacob wrote: > A bit like Ian Bicking's toppcloud: I think that is called silverlining currently. But I think this goes a step too far as it sets up whole servers, not just environments. I would like to have an extension that just deals for the mortal souls we are and that want to deploy to a handful of servers and maybe appengine. Also, silverlining is GPL licensed and as such could not be required for a flask extension which currently requires a more liberal license. > Maybe Flask-Deploy might be a better name, which could include the > server options ? Just a thought. The deployment stuff might be a setup.py extension provided by a flask extension as Stephane pointed out. Regards, Armin
Given that Flask already exposes a WSGI-compliant application, what would be the benefit of this extension ? How would it work ? On 1 September 2010 12:19, Armin Ronacher <armin.ronacher@active-4.com> wrote: > Hey everybody, > > Some idea I had a while back but not the time to actually implement it: > what about a Flask-Servers extension that provides commands to run the > application on all kinds of servers. > > It could run it on CherryPy, gunicorn, the builtin one and maybe even go > as far as providing a command that spits out mod_wsgi configs that you > can pipe into a file and just include. > > If someone is interested in doing that, why not pick up that idea? > > > Regards, > Armin >
Hi, On 2010-09-01 1:23 PM, Dan Jacob wrote: > Given that Flask already exposes a WSGI-compliant application, what > would be the benefit of this extension ? How would it work ? Some servers, especially CherryPy are quite evil to set up because you have to start the engine, properly tear it down again etc. Imagine a "python manage.py serve --server=cherrypy" and you are set. mod_wsgi requires a configuration very few people memorize. It would be incredible nice to have something like this: python manager.py generate-server-config mod_wsgi > app.inc There are some more things that would be possible, but I think that's a good start. Regards, Armin
On Wed, 2010-09-01 at 13:32 +0200, Armin Ronacher wrote: > Hi, > > On 2010-09-01 1:23 PM, Dan Jacob wrote: > > Given that Flask already exposes a WSGI-compliant application, what > > would be the benefit of this extension ? How would it work ? > Some servers, especially CherryPy are quite evil to set up because you > have to start the engine, properly tear it down again etc. > > Imagine a "python manage.py serve --server=cherrypy" and you are set. > > mod_wsgi requires a configuration very few people memorize. It would be > incredible nice to have something like this: > > python manager.py generate-server-config mod_wsgi > app.inc > > There are some more things that would be possible, but I think that's a > good start. > > > Regards, > Armin This should be a generic WSGi library; then Flask-Script could support it in its runserver command.
On 09/01/2010 01:32 PM, Armin Ronacher wrote: > Hi, > > On 2010-09-01 1:23 PM, Dan Jacob wrote: >> Given that Flask already exposes a WSGI-compliant application, what >> would be the benefit of this extension ? How would it work ? > Some servers, especially CherryPy are quite evil to set up because you > have to start the engine, properly tear it down again etc. > > Imagine a "python manage.py serve --server=cherrypy" and you are set. > > mod_wsgi requires a configuration very few people memorize. It would be > incredible nice to have something like this: > > python manager.py generate-server-config mod_wsgi > app.inc > > There are some more things that would be possible, but I think that's a > good start. > > > Regards, > Armin Hi Armin, Why not, But a generic template won't work with virtualenv In my case, I use mod_wsgi but I would like to transfert to gunicorn and nginx. For the configuration of a WSGI app, I think it's easy, here is my wsgi file for my application [code] #!/usr/bin/env python # -*- coding: utf-8 -*- WEBSITE_DIR = '/home/www/beta_caviste_be' SITE_PACKAGES_VIRTUAL_ENV = WEBSITE_DIR + '/caviste_env/lib/python2.5/site-packages' import site; site.addsitedir(SITE_PACKAGES_VIRTUAL_ENV) import os; os.environ['PYTHON_EGG_CACHE'] = WEBSITE_DIR + '/eggs' from caviste import create_app application = create_app() # vim: set ft=python:fileencoding=utf-8 [/code] And it's all. But for the apache configuration is more tricky and funny. <VirtualHost *:80> ServerAdmin stephane@wirtel.be ServerName beta.caviste.be DocumentRoot /home/www/beta_caviste_be WSGIDaemonProcess beta_caviste_be python-path=/home/www/beta_caviste_be user=www-data group=www-data threads=5 WSGIScriptAlias / /home/www/beta_caviste_be/caviste.wsgi <Directory /home/www/beta_caviste_be> WSGIProcessGroup beta_caviste_be WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory> ErrorLog /var/log/apache2/beta_caviste_be_error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel debug CustomLog /var/log/apache2/caviste_be_access.log combined </VirtualHost> So, now, we can use Flask-Script for this behaviour and add some specific commands for that. Regards, Stéphane
Hmm....maybe a bunch of commands you could hook into Flask-Script ? On 1 September 2010 12:32, Armin Ronacher <armin.ronacher@active-4.com> wrote: > Hi, > > On 2010-09-01 1:23 PM, Dan Jacob wrote: >> Given that Flask already exposes a WSGI-compliant application, what >> would be the benefit of this extension ? How would it work ? > Some servers, especially CherryPy are quite evil to set up because you > have to start the engine, properly tear it down again etc. > > Imagine a "python manage.py serve --server=cherrypy" and you are set. > > mod_wsgi requires a configuration very few people memorize. It would be > incredible nice to have something like this: > > python manager.py generate-server-config mod_wsgi > app.inc > > There are some more things that would be possible, but I think that's a > good start. > > > Regards, > Armin >
Hi,
On 2010-09-01 1:35 PM, Dan Jacob wrote:
> Hmm....maybe a bunch of commands you could hook into Flask-Script ?
Ah sorry, yes that is the idea.
Regards,
Armin