Modern APIs with FastAPI and Python Transcripts
Chapter: Deploying FastAPI on Linux with gunicorn and nginx
Lecture: venv forever

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So, on the server, It's only purpose is to run this web application. To run this web application, we need to have the virtual environment activated.
0:09 So what I'm going to show you is that, let's ask really which Python 3 real quick, so we know where it, there. Having
0:17 that directory is gonna help. What I'm gonna propose is that we change our log in, so as we log in it just activates that virtual environment.
0:23 Otherwise, if we do Python stuff, pip and Python and so on, It's gonna work with the system one. We almost never, ever want to change it.
0:30 We almost always just want to work with this one virtual environment. So let's just make that the default.
0:36 So we'd say "nano dot zshrc", go down to the bottom here and we'll say source, go to bin, Python will say activate, like that. If I exit
0:47 out and I log back in, look at this. Yes, it's the right one. If I "pip list", it's all the stuff that we just installed, FastAPI and so on.
0:58 That's super cool, right? So I totally recommend that you set it up so when you log into your server,
1:03 it just sets up the environment for that one and Web app. If you got 20 Web apps and all sorts of things going on,
1:08 maybe it doesn't make sense. In this simple world, I think this is the best thing to do.

Talk Python's Mastodon Michael Kennedy's Mastodon