The python module Flask is a small web framework.
Install the module using pip.
(my_new_env)[free-tutorials@free-tutorials ~]$ pip install Flask
Downloading/unpacking Flask
Downloading Flask-0.9.tar.gz (481kB): 481kB downloaded
Running setup.py egg_info for package Flask
warning: no files found matching '*' under directory 'tests'
...
...
Successfully installed Flask Werkzeug Jinja2
Cleaning up...
Create the next python script and save as : flask-web.py .
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
Run the python script:
(my_new_env)[free-tutorials@free-tutorials ~]$ python flask-web.py
* Running on http://127.0.0.1:5000/
127.0.0.1 - - [25/Jan/2013 00:10:35] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [25/Jan/2013 00:10:36] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [25/Jan/2013 00:10:36] "GET /robots.txt HTTP/1.1" 404 -
127.0.0.1 - - [25/Jan/2013 00:10:36] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [25/Jan/2013 00:10:36] "GET /robots.txt HTTP/1.1" 404 -
You will see something like this:
Also you can try the quickstart tutorial here.