Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def printer(self): # noqa
self.p = FakePrinter()
self.m = Manager(printer=self.p)
self.m._env = FakeEnv()
from honcho.manager import Manager
from honcho.printer import Printer
os.environ["PYTHONUNBUFFERED"] = "true"
# Make sure that the environment is prepared before honcho takes over
# This sets all the appropriate uwsgi env vars, etc
server.prepare_environment()
daemons += [("server", ["sentry", "run", "web"])]
if styleguide:
daemons += [("storybook", ["./bin/yarn", "storybook"])]
cwd = os.path.realpath(os.path.join(settings.PROJECT_ROOT, os.pardir, os.pardir))
manager = Manager(Printer(prefix=prefix))
for name, cmd in daemons:
manager.add_process(name, list2cmdline(cmd), quiet=False, cwd=cwd)
manager.loop()
sys.exit(manager.returncode)
def get_honcho_manager(self):
# this env var is necessary because if the botworker submits a wait page,
# it needs to broadcast to redis channel layer, not in-memory.
# this caused an obscure bug on 2019-09-21.
os.environ['OTREE_USE_REDIS'] = '1'
env_copy = os.environ.copy()
manager = HonchoManager()
# if I change these, I need to modify the ServerCheck also
manager.add_process('botworker', 'otree botworker', quiet=False, env=env_copy)
manager.add_process(
'timeoutworkeronly', 'otree timeoutworkeronly', quiet=False, env=env_copy
)
return manager
def create_honcho_manager(*, printer=None, mode="dev", **kwargs):
environ = {**os.environ, **kwargs.pop("environ", {}), "PYTHONUNBUFFERED": "1"}
from honcho.manager import Manager
m = Manager(printer=printer)
for proc_name, proc_cmd in sorted(get_procs(mode).items()):
m.add_process(proc_name, proc_cmd, env=environ)
return m