Browse Source

[core] Automatically run with Gunicorn when on Python 3

Romain Rigaux 4 năm trước cách đây
mục cha
commit
b4d1f65a57
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      desktop/core/src/desktop/conf.py

+ 5 - 1
desktop/core/src/desktop/conf.py

@@ -146,12 +146,16 @@ def get_slack_bot_user_token():
   """Returns Slack Bot User Token if set as environment variable else None"""
   return os.environ.get('SLACK_BOT_USER_TOKEN')
 
+def is_python2():
+  """Hue is running on Python 2."""
+  return sys.version_info[0] == 2
+
 
 USE_CHERRYPY_SERVER = Config(
   key="use_cherrypy_server",
   help=_("If set to true, CherryPy will be used. Otherwise, Gunicorn will be used as the webserver."),
   type=coerce_bool,
-  default=True)
+  dynamic_default=is_python2)
 
 GUNICORN_WORKER_CLASS = Config(
   key="gunicorn_work_class",