Flask App Integration?

132 views
Skip to first unread message

Jamie Jackson

unread,
Jul 21, 2011, 12:10:57 PM7/21/11
to isapi_wsgi-dev
Hi Folks,

I'm trying to move from old-school CGI to WSGI in an attempt to
improve performance and concurrency.

I've set up a virtualenv/iwhelper directory structure according to the
ISAPIWSGIHelper documentation (http://pypi.python.org/pypi/
ISAPIWSGIHelper/0.1.1).

I would really like to get some Flask example application up and
running so I can get an idea of how to hook IIS7 up to Flask and get a
feel for how I need to restructure *my* Python script to work as an
"application," etc.

I could use some hand-holding here. I've downloaded the application
that powers Flask's web site, and can use that as my test subject, but
if you know of something better to use, I'll go with that.

So iwhelper gives me this appinit.py (below), but I don't know how to
modify it for my purposes. Could someone give me a hand?

Thanks,
Jamie

#####################################################
# This setup assumes you have the isapi-wsgi directory installed
# in the root directory of a virtualenv:
#
# ..\myproj-venv
# - isapi-wsgi
# - Lib
# - Scripts
#
# If you have isapi-wsgi installed in a different location or are not
using
# a virtualenv, you CAN SAFELY MODIFY OR DELETE THE FOLLOWING TWO
LINES.
from iwhelper.utils import prepend_site_dir
prepend_site_dir(__file__, '..', 'Lib', 'site-packages')

# replace these two lines with the necessary imports to instantiate
your
# WSGI application and assign said application to __wsgiapp__.
from iwhelper.utils import hwapp
__wsgiapp__ = hwapp

Mark Rees

unread,
Jul 21, 2011, 11:28:28 PM7/21/11
to isapi_w...@googlegroups.com
Hi,

Haven't used Flask but from reading the deploy docs at the Flask site I think would be as simple as replacing the last 2 lines in the appinit.py with:

from yourapplication import app
__wsgiapp__ = app


where "yourapplication" is your flask main file name.

Mark


--
You received this message because you are subscribed to the Google Groups "isapi_wsgi-dev" group.
To post to this group, send email to isapi_w...@googlegroups.com.
To unsubscribe from this group, send email to isapi_wsgi-de...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/isapi_wsgi-dev?hl=en.


Jamie Jackson

unread,
Jul 26, 2011, 2:22:15 PM7/26/11
to isapi_w...@googlegroups.com
Sounds reasonable enough, thanks. ;-)

I'll try that out as soon as I get isapi-wsgi going. (I'll ask about that in a new thread.)

Thanks,
Jamie
Reply all
Reply to author
Forward
0 new messages