I will be installing and maintaining a Python 2.7-based server application on Ubuntu server (12.04). The model of maintenance will be to create a virtualenv and install application standard libraries (from PyPI) and custom libraries (bespoke) there, updating them as required. A separate folder holds the "application", which is made up of configuration files and application-specific Python files.
As far as I can tell, the only Ubuntu-provided packages I require are python
and python-virtualenv
. I may do a custom installation of pew to manage the venv - in which case I will sudo easy_install pew
and accept that wherever it goes is correct (pew isn't in the 12.04 repo).
I have a vague awareness that applications should live in /opt
or /srv
or somewhere like that, and that a server application may live in a different location to a user application. Give all that:
- where should the virtualenv be located?
- where should the server application folder be located?
For Django applications, Adam Bard recommends locating your virtualenv at /opt/apps/
and your application proper at /opt/apps/
. (Many thanks to don.joey for the excellent link.)
Slightly unrelated, I also found Hynek Schlawack's Python Deployment Anti-Patterns and Python Application Deployment with Native Packages to be useful reads.
Based on this, my own review of the Filesystem Hierarchy Standard and an inspection of the /opt
folder on my desktop machine, I went with:
/opt/virtualenv/
for the virtual environment/opt/
for the server application folder/
This allows me to create multiple independent virtualenvs and application folders for different applications, versions, etc as I see fit.
No comments:
Post a Comment