Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r 832f7d4a6f4c deploy/gunicorn_conf.py
- --- a/deploy/gunicorn_conf.py Thu Oct 28 14:29:39 2010 +0200
- +++ b/deploy/gunicorn_conf.py Thu Oct 28 13:36:19 2010 -0400
- @@ -1,16 +1,31 @@
- import sys
- -from os import sysconf
- +import os
- from pkg_resources import load_entry_point
- def numCPUs(default=1):
- - try:
- - return sysconf('SC_NPROCESSORS_ONLN')
- - except (AttributeError, ValueError):
- - return default
- + if not hasattr(os, "sysconf"):
- + raise RuntimeError("No sysconf detected.")
- + return os.sysconf("SC_NPROCESSORS_ONLN")
- +bind = "0.0.0.0:8000"
- workers = numCPUs() * 2 + 1
- +# redirect sys.stdout to sys.stderr for bad libraries like geopy that uses
- +# print statements for optional import exceptions.
- +sys.stdout = sys.stderr
- +
- +from os.path import abspath, dirname, join
- +sys.path.insert(0, abspath(join(dirname(__file__), "../../")))
- +
- +from site import addsitedir
- +addsitedir("/home/comunidad/.virtualenvs/comunidad/lib/python2.6/site-packages")
- +
- +from django.conf import settings
- +os.environ["DJANGO_SETTINGS_MODULE"] = "comunidad.settings"
- +
- # if run as a script, make it equivalent to "gunicorn_django -c THIS_FILE [OPTIONS]"
- if __name__ == '__main__':
- + sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))
- + sys.path.insert(0, join(settings.PROJECT_ROOT, "site-packages"))
- sys.argv[:0] = ['gunicorn_django', '-c']
- load_entry_point('gunicorn', 'console_scripts', 'gunicorn_django')()
Add Comment
Please, Sign In to add comment