Closed lazyguru closed 4 years ago
@josephmancuso any thoughts on this PR?
Don't we have a way to register the activated virtual environment location?
Don't we have a way to register the activated virtual environment location?
Yes, use foreman register <path/to/venv>
. This is called out in the error message displayed to the user:
self.line(f"<error>No virtual environment detected, not starting site {site}.</error>")
self.line("<error>Please register your venv by running:</error>")
self.line("<fg=magenta;options=bold> foreman register /path/to/venv</>")
EDIT: Just realized you were talking about using the currently activated environment. I can take a look at that. Do you think we should hold up the current PR for that?
Quick Google search provides this: https://stackoverflow.com/a/1883251/564576
@josephmancuso ok, I added support for already running inside a virtual environment. I also cleaned up the driver check to just display an error (this works nicer when you have multiple sites and only one of them is missing a driver). Take a look and let me know what you think
This maybe solves #3
At the moment, this does 2 things: 1) Adds a new configuration setting for venv_locations and defaults it to venv, env 2) If a virtual environment is not found and not able to be activated, it will refuse to start the site
Obviously, 2 is a bit opinionated as it makes the assumption that everyone is using virtual environments. It would be pretty easy to provide a hack for this if someone doesn't want to use virtual environments, but even then IMO they should be using virtual environments.
NOTE: I haven't tested this one at all yet. Just creating a draft PR so you can code review and let me know what you think about the code and 2 from above.