#100DaysOfWeb in Python Transcripts
Chapter: Days 1-4: Flask Intro
Lecture: Install and Setup Flask
0:00 Righty-o, quick video here.
0:01 Just on the setup for this application.
0:04 We have here Commander, I'm on Windows.
0:07 It's going to look similar regardless
0:09 of whatever you're environment is
0:10 that you're using or your OS.
0:13 I've created a directory called 1-flask
0:16 just 'cause we're on Chapter One
0:17 and we're building a Flask app, go figure!
0:21 What I would like you to do is create a directory
0:23 something like that, whatever you want to call it.
0:26 This is going to be your parent directory.
0:28 We're going to build our very first Flask application
0:31 within this directory.
0:33 The first thing we have to do after doing that
0:36 is arguably the most important thing you have to do
0:39 and that is create your virtual environment.
0:42 That will make sure everything we do here
0:44 all the packages we install, it's all self contained
0:47 in this awesome little virtual environment.
0:50 So because we're using Python 3
0:52 I would not be using Python 2.7 or whatever
0:56 for this course. We're doing it all in Python 3.
0:59 You can check your version with python --version.
1:03 I'm using 3.6. Haven't installed 3.7 yet.
1:06 Doesn't really matter for this.
1:08 Just make sure you're using Python 3.
1:11 Run the command, python -m venv venv
1:15 and what this will do is create
1:18 it will create a virtual environment called venv, okay?
1:24 Do an LS and you can see I've got this venv folder there.
1:30 Now, if you are using Windows, I hope you're using Commander
1:33 or some sort of Linux shell 'cause it is a bit of a pain
1:36 to do this on the default command line.
1:40 But that's completely up to you.
1:42 So what we're going to do is we're going to go in to the venv.
1:45 You'll see there is an include, lib and scripts directory.
1:51 This is different on Mac OS or Linux.
1:55 In those ones, you'll probably see a bin folder, okay?
1:59 A binary folder.
2:01 This one, because this is Windows
2:02 we're going to go into scripts and you'll see
2:06 there is an activate batch file, okay?
2:10 All we have to do is activate it.
2:13 And there you can see we have this virtual environment
2:17 little bracket thing in front of our command line.
2:20 That means that we have now activated
2:22 the virtual environment and everything we do
2:24 is going to be self contained in there.
2:26 If you are using Mac or Linux from
2:32 your parent directory here, where you see the venv directory
2:36 you're going to do source venv/bin/activate.
2:41 Running that command will initiate your virtual environment.
2:44 And that's it. Next, and next most important
2:49 you are going to install Flask.
2:52 All we really need to know for this specific chapter
2:56 is that we're installing Flask with pip.
2:58 So pip install flask.
3:00 And we'll let that install that
3:01 we'll install Flask and all of its dependencies.
3:04 You can see them flying up the screen there.
3:07 We don't need to install anything else.
3:09 Just ignore this if you see that.
3:12 I mean, you can always upgrade pip yourself, that's fine.
3:15 For me, I'm okay. And now, we can do a
3:19 pip list and this will show you
3:24 all of your installed packages. And that's it!
3:28 So, we have our environment installed.
3:30 We have Flask installed and we're now ready
3:33 to start creating the directory hierarchy here for Flask
3:37 and get cracking on our first app.