Where is the proper place to put Python virtual environments according to the Linux Filesystem Hierarchy Standard? -
Where is the proper place to put Python virtual environments according to the Linux Filesystem Hierarchy Standard? -
as title asks, technically proper location store python virtual environments on linux operating systems according linux fhs?
stated way allows clear answer: "technically correct" separate location of python virtual environment info files serving?
note: this question differs closest, already-asked question find, virtual-environments contain libraries, binaries, header files, , scripts.
as added complication, tend write code supports internet-accessible services. however, don't see substantially differentiating needs scenarios in consumers of service other processes on same server. i'm mentioning detail in case responses comments include "web dev"-esque content.
for reference, using next documentation definition of linux fhs: http://www.pathname.com/fhs/pub/fhs-2.3.html
i not believe popular virtualenv-wrapper script suggests right action, defaults storing virtual environments in user's home directory. violates implicit concept directory user-specific files, statement "no programme should rely on location."
from root level of file system, lean towards /usr
(shareable, read-only data) or /srv
(data services provided system), have hard time deciding further.
if go alongside decision of go-to reverse proxy, means /usr
. nginx commonly packaged go /usr/share/nginx or /usr/local/nginx, however, /usr/ supposed mounted read-only according fhs. find unusual because i've never worked on single project in development happened "unmount read-only/remount write, unmount/remount read-only" considered worth effort.
/srv
possible location, stated "location of info files particular service," whereas python virtual environment more focused on libraries , binaries provides service (without differentiation, .so
files in srv). also, multiple services same requirements share virtual environment, violates "particular" detail of description.
i believe part of difficulty in choosing right location because virtual environment "environment," consists of both binaries , libraries (almost own little hierarchy), pushes impression somewhere under /usr
more conventional:
virtual-env/ ├── bin ~= /usr/local : "for utilize scheme administrator when installing software locally" ├── include ~= /usr/include : "header files included c programs" ├── lib ~= /usr/lib : "libraries programming , packages" └── share ~= /usr/local
with assumptions , thoughts stated: consider mutual scenario of nginx acting reverse proxy python application. right place virtual environment , source code (e.g. application.py) under /usr/local/service_name/
while using /srv
files changed more (e.g. 'static' assets, images, css)?
edit: clear: know why , how utilize virtualenvs. no means confused project layouts or working in development environments.
as title asks, technically proper location store python virtual environments on linux operating systems according linux fhs?
keep in mind linux fhs not standard, set of guidelines. referred standard lsb - bunch of rules create supporting linux easier.
/run
, /sys
, /proc
, /usr/local
not part of lfs see them in linux distributions.
for me clear selection set virtual environments /opt
, because location reserved installation of add-on software packages.
however, on linux distributions root can write /opt
, makes poor selection because 1 of main goals of virtual environments avoid beingness root.
so, recommend /usr/local
(if writable normal user account) - there nil wrong installing in home directory.
stated way allows clear answer: "technically correct" separate location of python virtual environment info files serving?
i'm not sure mean "data files serving", here rules virtual environments:
don't set them in source control. maintain list of installed packages, , set this in version control. remember virtual environments not portable. keep virtual environment separate source code.given above, should maintain virtual environment separate source code.
consider mutual scenario of nginx acting reverse proxy python application. right place virtual environment , source code (e.g. application.py) under /usr/local/service_name/ while using /srv more dynamic files (e.g. 'static' assets, images)?
static assets not dynamic files, think confusing terms.
either way, should following:
create user business relationship run application. put application files under directory controlled user and user alone. typically/home/username
directory, can create /services/servicename
. place virtual environment subset of directory, in standard naming format. example, utilize env
. put static assets, such media files, css files, etc. in directory readable front end end server. so, typically create www
directory or public_html
directory. make sure user business relationship create application has write access asset directory, able update files. proxy server should not have execute permissions on directory. can accomplish changing grouping of directory same of proxy server user. given this, set directory under /home/username/
or /services/servicename
. launch application using process manager, , create sure process manager switches user 1 created in step 1 when running application code. finally, cannot stress plenty document process , automate it.
python linux virtualenv fhs
Comments
Post a Comment