Best practices for directories in which to store stuff in production

86 views
Skip to first unread message

Antonis Christofides

unread,
Nov 9, 2016, 7:37:39 AM11/9/16
to django...@googlegroups.com

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	

ludovic coues

unread,
Nov 9, 2016, 7:57:53 AM11/9/16
to django...@googlegroups.com
If I had to use such scheme, I would put the django application in a package for the target system. Like a .deb file for exemple.
If your primary way of deploying is a git push from test/QA to production, split directory will cause plenty of headaches.

Also, with an installation like this, I wouldn't use a virtualenv. By using /usr/local/lib, you are making your application a part of the system. It's like if a standard application was using a non-standard library. I wouldn't expect that.

But that's my 2 cents

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cc2851e9-89cc-3a87-aac6-b0532e5b2233%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

Vijay Khemlani

unread,
Nov 9, 2016, 2:19:30 PM11/9/16
to django...@googlegroups.com
I prefer to keep everything in /home (at least the virtualenv, project code, settings and logs), that way you don't need special permissions to modify those files and it is more or less separated from the system files.

static and media files in Amazon S3

Caching... I used memcached, so I have no experience with using files in that regard

Vineet Kothari

unread,
Nov 13, 2016, 5:58:12 PM11/13/16
to django...@googlegroups.com
Check out cookiecutter django github 

Reply all
Reply to author
Forward
0 new messages