问题
We have a python(3) venv rest api. In the same venv we have also installed and configured the application server uwsgi
the api is running on. And we are looking for a clean way to deploy it.
Until now we are deploying with is a simple script that creates the venv install the dependencies from pip and then runs the app.
I am wondering if using snap would be possible to package everything nicely and simply install them on a server.
Is that possible or a good practice to deploy a web api this way?
Thanks for your time.
回答1:
Yes, you can do this with snaps. You can use the python plugin module with snapcraft which extends your python path with a virtualenv.
Also, Its pretty easy to do this with a deb.
dh-virtualenv lets you use standard debian packaging tools. https://labs.spotify.com/2013/10/10/packaging-in-your-packaging-dh-virtualenv/
It is your choice.
来源:https://stackoverflow.com/questions/40116965/deploy-python-venv-as-snap