Tuesday, November 8, 2016

Best practices for directories in which to store stuff in production

Hello,

I was thinking about using this scheme:

/usr/local/lib/projectname
Program files (i.e. repository)
/usr/local/lib/projectname-virtualenv
Virtualenv
/var/lib/projectname/media
Media files
/var/cache/projectname/static
Static files, collected with collectstatic
/var/cache/projectname/cache
File-based cache
/var/log/projectname
Log files
/etc/projectname
Configuration (mostly settings.py)

I was wondering whether people could find it counter-intuitive, or whether there could be trouble training new recruits. I understand that some people are using /opt or /srv or /home, and that it may be common practice to put the virtualenv, static, and media files inside the repository working directory.

My backup script automatically excludes /usr and /var/cache from backup, so I can decide what shall be backed up just by placing it in the appropriate directory. This is the main reason I put static files and file-based cache in /var/cache, and why I dislike schemes where program files and data are put in a single directory such as /srv/projectname.

So how does the above look to you, and what other practices have you seen?

(I'm asking primarily because I'm writing a book on Django deployment and I'm wondering what best practice to propose to the reader.)

Thanks!
--   Antonis Christofides  http://djangodeployment.com	

No comments:

Post a Comment