update index.md (#29446)

Added short flask guide
pull/36341/head
Terho 2019-06-28 05:29:05 +03:00 committed by Randell Dawson
parent 755466765b
commit 7e7522fdfd
1 changed files with 28 additions and 1 deletions

View File

@ -19,7 +19,7 @@ So, let's create a virtual environment (also called a virtualenv). Virtualenv wi
For more information on virtual environments see the relevent section <a href='https://guide.freecodecamp.org/python/virtual-environments/' target='_blank' rel='nofollow'>here</a>.
## Wrapping Up
## Django
If you have already installed `pip` then simply:
```
@ -40,3 +40,30 @@ In next article, we would be discussing how to install PostgreSQL and use it wit
A point to ponder - we have been using `pip` heavily, but we have barely said anything about it. Well, for now, it's just a package manager like `npm`. It has some differences with `npm`; but, you don't need to worry about that now. If you are interested, do check out the <a href='http://pip-python3.readthedocs.org/en/latest/index.html' target='_blank' rel='nofollow'>official `pip` documentation</a>.
<em>If you have suggestions or questions, come join us on <a href='https://gitter.im/FreeCodeCamp/home' target='_blank' rel='nofollow'>gitter</a></em>.
## Flask
### Install Flask
```
$ pip install Flask
```
After installation create a test file ```freecodecamp.py```:
```
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return("Hello FreeCodeCamp!")
```
Run the flask application.
```
$ FLASK_APP=freecodecamp.py flask run
```
To see the ```freecodecamp.py``` file in web browser:
Go to `http://localhost:5000`and you should see "Hello FreeCodeCamp!".
More about flask documentation at <a href='http://flask.pocoo.org/docs/1.0/'>Flask docs</a>