@task
def apiserver(ctx, port=8000, wait=True, autoreload=True, host='127.0.0.1', pty=True):
 env = os.environ.copy()
 cmd = 'DJANGO_SETTINGS_MODULE=api.base.settings {} manage.py runserver {}:{} --nothreading'.format(sys.executable, host, port)
 if (not autoreload):
  cmd += ' --noreload'
 if settings.SECURE_MODE:
  cmd = cmd.replace('runserver', 'runsslserver')
  cmd += ' --certificate {} --key {}'.format(settings.OSF_SERVER_CERT, settings.OSF_SERVER_KEY)
 if wait:
  return ctx.run(cmd, echo=True, pty=pty)
 from subprocess import Popen
 return Popen(cmd, shell=True, env=env)

@ task def apiserver ( ctx , port = 8000 , wait = True , autoreload = True , host = '127.0.0.1' , pty = True ) : env = os . environ . copy ( ) cmd = 'DJANGO_SETTINGS_MODULE=api.base.settings {} manage.py runserver {}:{} --nothreading' . format ( sys . executable , host , port ) if ( not autoreload ) : cmd += ' --noreload' if settings . SECURE_MODE : cmd = cmd . replace ( 'runserver' , 'runsslserver' ) cmd += ' --certificate {} --key {}' . format ( settings . OSF_SERVER_CERT , settings . OSF_SERVER_KEY ) if wait : return ctx . run ( cmd , echo = True , pty = pty ) from subprocess import Popen return Popen ( cmd , shell = True , env = env )
run the api server .