|A nice primer on Python decorators | [http://bit.ly/25ij4gY](http://bit.ly/25ij4gY) | You might want to get a little under the hood on how the routes (and other) decorators work. |
## STEP 1: Environment check
You will minimally need Python 2.7.1x for this tutorial. Most if not all of the code will work in 3.5.x as well, so feel free to use that moving forward.
@@ -42,7 +46,7 @@ You will minimally need Python 2.7.1x for this tutorial. Most if not all of the
## Step 2: Build Your First Example App
We're now going to build our first functional app. It isn't going to do anything yet -- we just want to make sure that we can see that everything is looking good in out environment.
We're now going to build our first functional app. It isn't going to do anything yet -- we just want to make sure that we can see that everything is looking good in our environment.
1. Open your favorite editor and **create the file `app.py`**.
@@ -68,7 +72,7 @@ You should see the following:
4. Hooray! You have your first Flask app, test it by opening your browser and pointing it to [localhost:5000](http://localhost:5000) (**except if** you don't see that last line `* Running ...`, then something is really wrong!)
1. **NOTE:** You haven't implemented any endpoints/routes, so you should get HTTP/404 when you hit [localhost:5000](http://localhost:5000). This is the correct behavior.
2. The default port is `5000`, which can be changed later
2. The default port is `5000`, which can be changed later.
## Step 3: Let's dissect what is going on ...
@@ -83,7 +87,7 @@ This is a required import to get any basic Flask app running ... don't forget it
```python
app = Flask(__name__)
```
This variable is necessary to initialize the Flask app -- it is the [Application Object](http://flask.pocoo.org/docs/0.11/api/#application-object). We're giving the name `__name__` because we are running this application as a standalone in a single file (`app.py`). You can read more about how Python handles application and module name spaces, but if a file you create is run from the command line, you it's application `__name__` attribute will be set to `__main__` (unless overridden by the developer, but that is not a typical move in Python, so don't go playing footsy with it until you know why you might want to do so!)
This variable is necessary to initialize the Flask app -- it is the [Application Object](http://flask.pocoo.org/docs/0.11/api/#application-object). We're giving the name `__name__` because we are running this application as a standalone in a single file (`app.py`). You can read more about how Python handles application and module name spaces, but if a file you create is run from the command line, its application `__name__` attribute will be set to `__main__` (unless overridden by the developer, but that is not a typical move in Python, so don't go playing footsy with it until you know why you might want to do so!)
```python
if __name__ == "__main__":
@@ -98,7 +102,7 @@ This last bit of code tells Python that if this file is run from the command lin
### Change the port
Let's change the port to something like `5200` using the `port` parameter if the `Flask.run()` method like this:
Let's change the port to something like `5200` using the `port` parameter of the `Flask.run()` method like this: