Book Image

Building Web Applications with Flask

By : Italo M Campelo Maia, Jack Stouffer, Gareth Dwyer, Italo Maia
Book Image

Building Web Applications with Flask

By: Italo M Campelo Maia, Jack Stouffer, Gareth Dwyer, Italo Maia

Overview of this book

Table of Contents (17 chapters)
Building Web Applications with Flask
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding the "Hello World" app


Given the environment set, what should we use to write our beautiful code? An editor or an IDE? If you're working on a low budget, try Light Table editor (http://lighttable.com/). Free, fast, and easy to use (Ctrl + Spacebar gives you access to all available options), it also has workspace support! Can't get any better for the money. If you're a lucky one with $200 to spare (or if you have a free license https://www.jetbrains.com/pycharm/buy/), just fork out for the PyCharm IDE which is pretty much the best IDE for Python Web development. Now let's move on.

Create a folder that will hold your project files (you don't need to but people will like you more if you do), as follows:

mkdir hello_world

Enter the new project folder and create the main.py file:

cd hello_world
touch main.py

The main.py file will have the whole "Hello World" application in it. Our main.py content should be like this:

# coding:utf-8
from flask import Flask
app = Flask(__name__)

@app...