#100DaysOfWeb in Python Transcripts
Chapter: Days 1-4: Flask Intro
Lecture: Install and Setup Flask

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


Talk Python's Mastodon Michael Kennedy's Mastodon