Python venv and cgi

How is everyone using python venv as a cgi script? is it unwise to put the env in the cgi dir? I assume you just create a wrapper to activate the env and run the script.

I broke DSN with a server upgrade and now I'm forced into venvs.

at least I think so

Posted in: s/programming

๐Ÿ€ gritty

2025-01-15 ยท 1 year ago ยท ๐Ÿค” 1

3 Comments โ†“

๐ŸŒ† skyjake [...] ยท 2025-01-16 at 04:34:

So far I've not been using venvs with CGI, instead installing dependencies system-wide and making sure the right version of the Python interpreter is used for running the CGI script.

If you do use venv, I believe you can launch the CGI script using the Python interpreter in the venv's bin directory even if the venv isn't active.

๐Ÿ€ gritty [OP] ยท 2025-01-16 at 17:10:

@skyjake ah okay. maybe i need to try another approach because pip and pipx both yell at me when installing a lib antenna requires. I think there's a flag to override it though, I'll try that.

๐ŸŒ† skyjake [...] ยท 2025-01-16 at 17:23:

This is what I've been using with pip: