Skip to content

Instantly share code, notes, and snippets.

@peterwillcn
Forked from drawks/graphite
Created September 13, 2013 08:59
Show Gist options
  • Save peterwillcn/6548276 to your computer and use it in GitHub Desktop.
Save peterwillcn/6548276 to your computer and use it in GitHub Desktop.
#This is the "site config" for nginx
upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
ip_hash;
server unix:/tmp/uwsgi.sock;
}
server {
listen 8080;
server_name graphite;
charset utf-8;
# Django admin media.
location /media/admin/ {
alias /usr/lib/python2.7/site-packages/django/contrib/admin/media/;
}
# Your project's static media.
location /content/ {
alias /usr/share/graphite/webapp/content/;
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include uwsgi_params;
}
}
#This is the uwsgi configfile
[uwsgi]
vacuum = true
master = true
processes = 8
pidfile = /tmp/uwsgi.pid
socket = /tmp/uwsgi.sock
chmod-socket = 666
gid = www-data
uid = www-data
pythonpath = /usr/share/graphite/webapp
home = /home/drawks/graphite-sb
pymodule-alias = graphite.local_settings=/etc/graphite/local_settings.py
module = wsgi
buffer-size = 65536
#This is the wsgi target that lives under the webapp subdirectory
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment