Saturday, January 26, 2013

Using Flask to build websites in Python.

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 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 : .

from flask import Flask
app = Flask(__name__)

def hello_world():
    return 'Hello World!'

if __name__ == '__main__':

Run the python script:

(my_new_env)[free-tutorials@free-tutorials ~]$ python 
 * Running on - - [25/Jan/2013 00:10:35] "GET / HTTP/1.1" 200 - - - [25/Jan/2013 00:10:36] "GET /favicon.ico HTTP/1.1" 404 - - - [25/Jan/2013 00:10:36] "GET /robots.txt HTTP/1.1" 404 - - - [25/Jan/2013 00:10:36] "GET /favicon.ico HTTP/1.1" 404 - - - [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.


Olivian said...

What's the plugin's whole purpose and how does it work? It seems interesting.

Catalin George Festila said...

You can use snippet and extensions. My post just show how to use the flask. You can try more on flask website. :)
Try this link

Post a Comment