Saturday, July 24, 2010

Full Frontal Maleblog

Exoplanets: Kepler finds lots Earth-sized planets

Flask (A Python Micro Framework)
is a very promising so-called micro-framework for the development Python web applications. After installing mod_wsgi (See my previous post
installing mod_wsgi on Mac OS X 10.6
), is the use of Flask on Mac OS X no more obstacles. I go in the following assume that Python 2.6 and Python Setup Tools are already installed with MacPorts. Then you should

first The real easy-install-command select
> easy_install-2.6 Which
/ opt/local/bin/easy_install-2.6

> sudo easy_install-2.6 flask

third An example application Write:
> pico helloflask.py
import from flask Flask

app = Flask (__name__)

@app.route ("/")
def hello_flask ():
return "Hello Flask!"

if __name__ == "__main__":
app.run ()

> pico hello.wsgi
import sys
sys.path.append ("/ Users / username / Sites / webapp") from helloflask import app as application

4th Both files
hello.wsgi and helloflask.py
should be put in
/ Users / username / Sites / webapp
that the configured WSGIScriptAlias should be part of the Virtual Host
mydomain.org
(See Installation of mod_wsgi on Mac OS X 10.6 ).
5th mydomain.org call:
If everything went well we welcomed our first Flask Web application when calling
mydomain.org
in the browser with "Hello Flask!" .

0 comments:

Post a Comment