From 7e7522fdfdd59d5bfadca1f7622bd56a68672f92 Mon Sep 17 00:00:00 2001 From: Terho <35961163+Naapi@users.noreply.github.com> Date: Fri, 28 Jun 2019 05:29:05 +0300 Subject: [PATCH] update index.md (#29446) Added short flask guide --- .../index.md | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/guide/english/python/setting-up-python-web-framework-django-and-flask/index.md b/guide/english/python/setting-up-python-web-framework-django-and-flask/index.md index b98ba6535d7..a3236cb1f4e 100644 --- a/guide/english/python/setting-up-python-web-framework-django-and-flask/index.md +++ b/guide/english/python/setting-up-python-web-framework-django-and-flask/index.md @@ -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 here. -## 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 official `pip` documentation. If you have suggestions or questions, come join us on gitter. + +## 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 Flask docs