Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 7129  / 2 Years ago, sun, january 16, 2022, 10:01:59

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?


More From » 12.04

 Answers
2

For Django applications, Adam Bard recommends locating your virtualenv at /opt/apps/<appname>-env and your application proper at /opt/apps/<appname>-env/site. (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/<env_name> for the virtual environment

  • /opt/<vendor_name>/<app_name> 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.


[#27013] Tuesday, January 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bathtusain

Total Points: 380
Total Questions: 124
Total Answers: 111

Location: Trinidad and Tobago
Member since Sat, Apr 9, 2022
2 Years ago
;