Friday 30 January 2015

flask introduction and installation

Standard
after more days i have came back for give you something if you are new in python and web development and also you are not good in django then i will prefer you FLASK framework this is a nice and more easy framework and also flask have a good Document.
so if you wan to hands on django then i prefer at first start flask then django

Flask is a small framework by most standards, small enough to be called a “micro-framework.” It is small enough that once you become familiar with it.
But being small does not mean that it does less than other frameworks. Flask was designed as an extensible framework from the ground up; it provides a solid core with the basic services, while extensions provide the rest. Because you can pick and choose the extension packages that you want.
Flask has two main dependencies. The routing, debugging, and Web Server Gateway Interface (WSGI) subsystems come from Werkzeug, while template support is provided by Jinja2.There is no native support in Flask for accessing databases, validating web forms, authenticating users, or other high-level tasks. These and many other key services most web applications need are available through extensions that integrate with the core packages.

this is a small introduction of flask so now i will tell you how install and cooked your project in flask

ok now start flask installation first of all open your terminal and go to your project folder and next type bellow command

$ pip install flask

after some process your flask installation will complete so now you can write your code
first test a program because of your flask install completely
open text editer and copy bellow program and save by "app.py" name


from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
    return '<h1>Hello World!</h1>'
if __name__ == '__main__':
    app.run(debug=True)

after save file open terminal and type

$python app.py

next open your browser and type 127.0.0.1:5000 then you will see your first flask project output

continue ............