Image for post
Image for post
Photo by Glenn Carstens-Peters on Unsplash

Building Your First Flask App

Babatunde Koiki
Apr 17, 2020 · 7 min read
Image for post
Image for post
Photo by Austin Distel on Unsplash

Objectives of this article

Image for post
Image for post
Flask is fun.

Flask Web Development

Virtual Environment

Image for post
Image for post
py -m pip --version
## You should get something like the one below.
## pip 9.0.1 from c:\python36\lib\site-packages (Python 3.6.1)
##You can upgrade your pip by writing
py -m pip install --upgrade pip
python3 -m pip install --user --upgrade pippython3 -m pip --version
## pip 9.0.1 from $HOME/.local/lib/python3.6/site-packages (python 3.6)
python3 -m pip install --user virtualenv # For Mac and Linux userspy -m pip install --user virtualenv # For Windows user
py -m venv env # For Windows users
python3 -m venv env # For Mac and Linux users
source env/bin/activate #For Mac and Linux users
.\env\Scripts\activate #For Windows users.
which python # For Windows users
.../env/bin/python
where python # For Mac and Linux users
.../env/bin/python.exe
deactivate
pip install flask
Image for post
Image for post
Image you should get after installing flask.

python “import flask; print(flask.__version__)”

#1.1.2

Let’s build our Flask App

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Our Simple App

Let’s Add HTML To Our Page

Image for post
Image for post
the medium folder
Image for post
Image for post
In the .py file
Image for post
Image for post
home.html
Image for post
Image for post
about.html
Image for post
Image for post
home page without any endpoint
Image for post
Image for post
home page with endpoint
Image for post
Image for post
about page

Con

The Startup

Medium's largest active publication, followed by +775K people. Follow to join our community.

Babatunde Koiki

Written by

I’m a back enddeveloper experienced in building APIs and web applications, I’m also an AI/ML/DL/DS Engineer and a JavaScript enthusiasts, lover of ReactJS.

The Startup

Medium's largest active publication, followed by +775K people. Follow to join our community.

Babatunde Koiki

Written by

I’m a back enddeveloper experienced in building APIs and web applications, I’m also an AI/ML/DL/DS Engineer and a JavaScript enthusiasts, lover of ReactJS.

The Startup

Medium's largest active publication, followed by +775K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store