equal
deleted
inserted
replaced
1042 appcfg.save() |
1042 appcfg.save() |
1043 |
1043 |
1044 |
1044 |
1045 # WSGI ######### |
1045 # WSGI ######### |
1046 |
1046 |
|
1047 WSGI_CHOICES = {} |
|
1048 from cubicweb.wsgi import server as stdlib_server |
|
1049 WSGI_CHOICES['stdlib'] = stdlib_server |
|
1050 try: |
|
1051 from cubicweb.wsgi import wz |
|
1052 except ImportError: |
|
1053 pass |
|
1054 else: |
|
1055 WSGI_CHOICES['werkzeug'] = wz |
|
1056 |
|
1057 |
1047 def wsgichoices(): |
1058 def wsgichoices(): |
1048 try: |
1059 return tuple(WSGI_CHOICES) |
1049 from werkzeug import serving |
1060 |
1050 except ImportError: |
|
1051 return ('stdlib',) |
|
1052 return ('stdlib', 'werkzeug') |
|
1053 |
1061 |
1054 class WSGIStartHandler(InstanceCommand): |
1062 class WSGIStartHandler(InstanceCommand): |
1055 """Start an interactive wsgi server """ |
1063 """Start an interactive wsgi server """ |
1056 name = 'wsgi' |
1064 name = 'wsgi' |
1057 actionverb = 'started' |
1065 actionverb = 'started' |
1058 arguments = '<instance>' |
1066 arguments = '<instance>' |
1059 options = ( |
1067 |
|
1068 @property |
|
1069 def options(self): |
|
1070 return ( |
1060 ("debug", |
1071 ("debug", |
1061 {'short': 'D', 'action': 'store_true', |
1072 {'short': 'D', 'action': 'store_true', |
1062 'default': False, |
1073 'default': False, |
1063 'help': 'start server in debug mode.'}), |
1074 'help': 'start server in debug mode.'}), |
1064 ('method', |
1075 ('method', |
1081 def wsgi_instance(self, appid): |
1092 def wsgi_instance(self, appid): |
1082 config = cwcfg.config_for(appid, debugmode=self['debug']) |
1093 config = cwcfg.config_for(appid, debugmode=self['debug']) |
1083 init_cmdline_log_threshold(config, self['loglevel']) |
1094 init_cmdline_log_threshold(config, self['loglevel']) |
1084 assert config.name == 'all-in-one' |
1095 assert config.name == 'all-in-one' |
1085 meth = self['method'] |
1096 meth = self['method'] |
1086 if meth == 'stdlib': |
1097 server = WSGI_CHOICES[meth] |
1087 from cubicweb.wsgi import server |
|
1088 else: |
|
1089 from cubicweb.wsgi import wz as server |
|
1090 return server.run(config) |
1098 return server.run(config) |
1091 |
1099 |
1092 |
1100 |
1093 |
1101 |
1094 for cmdcls in (ListCommand, |
1102 for cmdcls in (ListCommand, |