# fcgi/management/commands/startfcgi.pyfromdjango.core.management.baseimportNoArgsCommandfromdjango.core.management.commandsimportrunfcgiclassCommand(NoArgsCommand):defhandle_noargs(self,**options):args=self.get_args()ifisinstance(args,str):returnargsreturnrunfcgi.Command().execute(*args,**options)defget_args(self):fromdjango.confimportsettingsifnotgetattr(settings,'FCGI_PIDFILE',None):return'FCGI_PIDFILE must be specified in your settings'return['%s=%s'%(attr.split('_')[1].lower(),getattr(settings,attr))forattrindir(settings)ifattr.startswith('FCGI_')]# fcgi/management/commands/stopfcgi.pyfromdjango.core.management.baseimportNoArgsCommandclassCommand(NoArgsCommand):defhandle_noargs(self,**options):importosfromdjango.confimportsettingspidfile=getattr(settings,'FCGI_PIDFILE',None)ifnotpidfile:return'FCGI_PIDFILE must be specified in settings'os.kill(int(open(pidfile).read()),15)