How can I deploy and host multiple python projects with different dependancies on the same server at the same time?
Create a virtual environment for each project. Run each application (the first time you try to do this, each application will fail). Research and install the packages that you think you might need to successfully run each application. Successfully run each application.
Switching between two virtual environment is easy. You can run deactivate command and source the other virtual environment.
By default, that will be the version of python that is used for any new environment you create. However, you can specify any version of python installed on your computer to use inside a new environment with the -p flag : $ virtualenv -p python3. 2 my_env Running virtualenv with interpreter /usr/local/bin/python3.
It's not true of course that only one virtualenv can be activated at once. Yes, only one can be active in a shell session at once, but your sites are not deployed via shell sessions. Each WSGI process, for example, will create its own environment: so all you need to do is to ensure that each wsgi script activates the correct virtualenv, as is (in the case of mod_wsgi at least) well documented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With