public
Created

  • Download Gist
__init__.py
Python
1 2 3 4 5
import os
from git import Repo as GitRepo
 
repo = GitRepo(os.path.dirname(__file__))
VERSION = (2, 0, 0, 'Codename', 'beta', repo.head.commit.hexsha[:8])
nginx.conf
Nginx
1 2 3 4 5 6 7 8 9 10 11 12
server {
listen 0.0.0.0:80;
server_name public.myproject.com;
expires max;
gzip on;
 
rewrite "/static/[a-f0-9]{8}/(.+)" /static/$1 break;
 
location / {
root /srv/www/myproject/public;
}
}
settings.py
Python
1 2 3 4 5 6 7
from myproject import VERSION
 
MEDIA_ROOT = os.path.join(PUBLIC_DIR, 'media')
MEDIA_URL = 'http://xxxx.cloudfront.net/media/'
 
STATIC_ROOT = os.path.join(PUBLIC_DIR, 'static')
STATIC_URL = 'http://xxxx.cloudfront.net/static/%s/' % VERSION[5]

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.