equal
deleted
inserted
replaced
11 import sys |
11 import sys |
12 import tempfile |
12 import tempfile |
13 import time |
13 import time |
14 import threading |
14 import threading |
15 import subprocess |
15 import subprocess |
|
16 |
|
17 import wsgicors |
16 |
18 |
17 from cubicweb import BadCommandUsage, ExecutionError |
19 from cubicweb import BadCommandUsage, ExecutionError |
18 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg |
20 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg |
19 from cubicweb.cwctl import CWCTL, InstanceCommand, init_cmdline_log_threshold |
21 from cubicweb.cwctl import CWCTL, InstanceCommand, init_cmdline_log_threshold |
20 |
22 |
261 host = cwconfig['interface'] |
263 host = cwconfig['interface'] |
262 port = cwconfig['port'] or 8080 |
264 port = cwconfig['port'] or 8080 |
263 |
265 |
264 pyramid_config = make_cubicweb_application(cwconfig) |
266 pyramid_config = make_cubicweb_application(cwconfig) |
265 |
267 |
|
268 app = pyramid_config.make_wsgi_app() |
|
269 |
|
270 # This replaces completely web/cors.py, which is not used by |
|
271 # pyramid_cubicweb anymore |
|
272 app = wsgicors.CORS( |
|
273 app, |
|
274 origin=' '.join(cwconfig['access-control-allow-origin']), |
|
275 headers=','.join(cwconfig['access-control-allow-headers']), |
|
276 methods=','.join(cwconfig['access-control-allow-methods']), |
|
277 credentials='true') |
|
278 |
266 repo = cwconfig.repository() |
279 repo = cwconfig.repository() |
267 try: |
280 try: |
268 repo.start_looping_tasks() |
281 repo.start_looping_tasks() |
269 waitress.serve( |
282 waitress.serve(app, host=host, port=port) |
270 pyramid_config.make_wsgi_app(), host=host, port=port) |
|
271 finally: |
283 finally: |
272 repo.shutdown() |
284 repo.shutdown() |
273 if self._needreload: |
285 if self._needreload: |
274 return 3 |
286 return 3 |
275 return 0 |
287 return 0 |