def setup_celery(self, secureops="secureops", pythonpath=""):
        username = "opus"+self.projectname

        # create user and vhost
        log.info("Creating the RabbitMQ user and vhost")
        proc = subprocess.Popen([secureops, '-e', username],
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
                )
        password = proc.communicate()[0]
        ret = proc.wait()
        if ret:
            # password is not a password if it failed, but the error output
            raise DeploymentException("Creating RabbitMQ user/vhost failed. Ret:{0}. Output:{1}".format(ret, password))
        log.debug("Secure ops finished. Ret: {0}".format(ret))

        
        self.config['BROKER_HOST'] = 'localhost'
        self.config['BROKER_PORT'] = 5672
        self.config['BROKER_USER'] = username
        self.config['BROKER_PASSWORD'] = password
        self.config['BROKER_VHOST'] = username
        self.config.save()

        path_to_python = os.path.join(self.projectdir, "env", "bin", "python")

        # Set up a supervisord configuration file
        supervisordconf = """
[supervisord]
logfile=%(here)s/log/supervisord.log
pidfile=%(here)s/run/supervisord.pid
loglevel=debug

[program:celeryd]
command={python} django-admin.py celeryd --loglevel=INFO
directory=%(here)s
numprocs=1
stdout_logfile=%(here)s/log/celeryd.log
stderr_logfile=%(here)s/log/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
environment=PYTHONPATH="{path}:%(here)s",OPUS_SETTINGS_FILE={opussettings!r},DJANGO_SETTINGS_MODULE=settings

[program:celerybeat]
command={python} django-admin.py celerybeat --loglevel=INFO -s %(here)s/sqlite/celerybeat-schedule.db
directory=%(here)s
numprocs=1
stdout_logfile=%(here)s/log/celerybeat.log
stderr_logfile=%(here)s/log/celerybeat.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
environment=PYTHONPATH="{path}:%(here)s",OPUS_SETTINGS_FILE={opussettings!r},DJANGO_SETTINGS_MODULE=settings
""".format(path=pythonpath,
        opussettings=str(os.path.join(self.projectdir, "opussettings.json")),
        python = path_to_python)

        conffilepath = os.path.join(self.projectdir, "supervisord.conf")
        with open(os.path.join(self.projectdir, "supervisord.conf"), 'w') as sobj:
            sobj.write(supervisordconf)
Uses rabbitmqctl to create a celery user and vhost, then configures
dataset/ETHPy150Open bmbouter/Opus/opus/lib/deployer/__init__.py/ProjectDeployer.setup_celery