Guest User

Untitled

a guest
Jun 20th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. diff -r 832f7d4a6f4c deploy/gunicorn_conf.py
  2. --- a/deploy/gunicorn_conf.py Thu Oct 28 14:29:39 2010 +0200
  3. +++ b/deploy/gunicorn_conf.py Thu Oct 28 13:36:19 2010 -0400
  4. @@ -1,16 +1,31 @@
  5. import sys
  6. -from os import sysconf
  7. +import os
  8. from pkg_resources import load_entry_point
  9.  
  10. def numCPUs(default=1):
  11. - try:
  12. - return sysconf('SC_NPROCESSORS_ONLN')
  13. - except (AttributeError, ValueError):
  14. - return default
  15. + if not hasattr(os, "sysconf"):
  16. + raise RuntimeError("No sysconf detected.")
  17. + return os.sysconf("SC_NPROCESSORS_ONLN")
  18.  
  19. +bind = "0.0.0.0:8000"
  20. workers = numCPUs() * 2 + 1
  21.  
  22. +# redirect sys.stdout to sys.stderr for bad libraries like geopy that uses
  23. +# print statements for optional import exceptions.
  24. +sys.stdout = sys.stderr
  25. +
  26. +from os.path import abspath, dirname, join
  27. +sys.path.insert(0, abspath(join(dirname(__file__), "../../")))
  28. +
  29. +from site import addsitedir
  30. +addsitedir("/home/comunidad/.virtualenvs/comunidad/lib/python2.6/site-packages")
  31. +
  32. +from django.conf import settings
  33. +os.environ["DJANGO_SETTINGS_MODULE"] = "comunidad.settings"
  34. +
  35. # if run as a script, make it equivalent to "gunicorn_django -c THIS_FILE [OPTIONS]"
  36. if __name__ == '__main__':
  37. + sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))
  38. + sys.path.insert(0, join(settings.PROJECT_ROOT, "site-packages"))
  39. sys.argv[:0] = ['gunicorn_django', '-c']
  40. load_entry_point('gunicorn', 'console_scripts', 'gunicorn_django')()
Add Comment
Please, Sign In to add comment