I started a virtualenv session, and inside a directory dir, I have the following directory hierarchy:
| venv -- the virtual environment
| app_dir
main.py
| dir1
| dir2
| dir2
I’ve installed flask for this environment, which main.py uses. When I run $ python main.py, it will run through flask. My question here is – does app_dir and venv have to be sibling directories? Or can I have app_dir somewhere else? If so, how does main.py recognise flask to be in venv?
Just to be extra thorough, this is what you need to do to get your virtualenv working. After you install your virtualenv you just need to source it so that your current shell uses the virtualenv
In order to source the virtualenv you’d do this:
So, as long as you source the correct virtualenv. Your
app_dirandvenvdirectories could be anywhere on your system.