Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
      You have completed Create a Portfolio Using Python and Flask!
      
    
You have completed Create a Portfolio Using Python and Flask!
Preview
    
      
  In this video, we’ll preview what we are building, set up a new Flask project, prepare our assets, and create a repo.
Prerequisites
- Python Basics | Course
- How to Install Python (macOS) | Workshop
- How to Install Python (Windows) | Workshop
Resources
- Python Virtual Environments | Workshop
- Git and GitHub Workflow for Developers | Workshop
- Create a Portfolio Using HTML and CSS | Workshop
Commands
To create a Python virtual environment
- 
python3 -m venv env(macOS)
- 
python -m venv env(Windows)
To activate a virtual environment
- 
source ./env/bin/activate(macOS)
- 
.\env\Scripts\activate(Windows)
To deactivate a virtual environment
- deactivate
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
                      [MUSIC]
                      0:00
                    
                    
                      Hello, Pythonistas, Brian here.
                      0:09
                    
                    
                      Today, we'll assemble
a portfolio site using Flask,
                      0:12
                    
                    
                      a popular Python framework for
creating websites.
                      0:16
                    
                    
                      A portfolio is essential for developers,
whether you're just starting or a pro.
                      0:19
                    
                    
                      Think of your portfolio
as your display window,
                      0:25
                    
                    
                      showing off all the fabulous
projects you've worked on.
                      0:28
                    
                    
                      Plus, making a portfolio is
a fantastic project on its own.
                      0:31
                    
                    
                      We'll use the project Travis
created with vanilla HTML, CSS, and
                      0:36
                    
                    
                      JavaScript as a starting point.
                      0:40
                    
                    
                      If you're interested in how the structure,
styles, and JavaScript were created,
                      0:43
                    
                    
                      you can find a link to his workshop
in the teacher's notes below.
                      0:48
                    
                    
                      Let's get started.
                      0:52
                    
                    
                      I've created a new project folder
named MY-PYTHON-PORTFOLIO,
                      0:53
                    
                    
                      moved the project files into it, and
open it inside Visual Studio Code.
                      0:58
                    
                    
                      In the project files for this workshop,
                      1:04
                    
                    
                      you'll find the assets from
Travis that we'll be using.
                      1:06
                    
                    
                      We'll primarily focus on Travis's HTML,
                      1:09
                    
                    
                      using that to create our reusable
templates for each portfolio section.
                      1:12
                    
                    
                      Let's create an app.py file,
then a README.md file.
                      1:18
                    
                    
                      For now,
I will just type # My Python Portfolio.
                      1:22
                    
                    
                      I encourage you, though,
to flesh this file out with more details.
                      1:27
                    
                    
                      Then, open the terminal to activate
our virtual environment and
                      1:31
                    
                    
                      install the Flask framework.
                      1:35
                    
                    
                      I will be running the commands for MacOS.
                      1:37
                    
                    
                      The equivalent Windows commands
will be in the teacher's notes.
                      1:40
                    
                    
                      Running python3 -m venv env will
create the virtual environment.
                      1:44
                    
                    
                      Now we must activate the virtual
environment by running the activate script
                      1:51
                    
                    
                      it created for us.
                      1:56
                    
                    
                      Now that we have our environment set up,
                      2:04
                    
                    
                      let's install Flask by
running pip install flask.
                      2:07
                    
                    
                      Now that we have our core setup done, we
should create a Git repo for the project.
                      2:19
                    
                    
                      We'll create a .gitignore
file to flag files and
                      2:24
                    
                    
                      folders we don't want to
be added to our repo.
                      2:28
                    
                    
                      Let's start by adding the env folder,
then .vscode, pycache, and
                      2:31
                    
                    
                      if you're on a Mac, .DS_Store.
                      2:36
                    
                    
                      Next, let's run git init, git add dot,
and git commit -m init commit.
                      2:47
                    
                    
                      Now let's get our repo hosted on GitHub.
                      2:56
                    
                    
                      We'll head to github.com/new,
give the repo a name,
                      2:58
                    
                    
                      Then click Create repository.
                      3:06
                    
                    
                      Lastly, click this button to copy
the three commands for an existing repo.
                      3:14
                    
                    
                      Let's paste the three commands
into the terminal and hit Enter.
                      3:18
                    
                    
                      Perfect, our project is now on GitHub.
                      3:27
                    
                    
                      We'll be coming back to this
GitHub repo in a later video.
                      3:30
                    
              
        You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up