@task(aliases=['celery'])
def celery_worker(ctx, level='debug', hostname=None, beat=False):
 os.environ['DJANGO_SETTINGS_MODULE'] = 'api.base.settings'
 cmd = 'celery worker -A framework.celery_tasks -l {0}'.format(level)
 if hostname:
  cmd = (cmd + ' --hostname={}'.format(hostname))
 if beat:
  cmd = (cmd + ' --beat')
 ctx.run(bin_prefix(cmd), pty=True)

@ task ( aliases = [ 'celery' ] ) def celery_worker ( ctx , level = 'debug' , hostname = None , beat = False ) : os . environ [ 'DJANGO_SETTINGS_MODULE' ] = 'api.base.settings' cmd = 'celery worker -A framework.celery_tasks -l {0}' . format ( level ) if hostname : cmd = ( cmd + ' --hostname={}' . format ( hostname ) ) if beat : cmd = ( cmd + ' --beat' ) ctx . run ( bin_prefix ( cmd ) , pty = True )
run the celery process .