summaryrefslogtreecommitdiff
path: root/addons/web/__init__.py
diff options
context:
space:
mode:
authorAntony Lesuisse <al@openerp.com>2011-09-09 18:00:39 +0200
committerAntony Lesuisse <al@openerp.com>2011-09-09 18:00:39 +0200
commitdf5dd1f7b7d4ad8219009d97774b22ddc017d33a (patch)
treeedb4d4fca50b6976405d36111905e5d0e2f5ed0d /addons/web/__init__.py
parent99c0bdd0fb1761925ed410e76dbfcfb5b70cbeb6 (diff)
[IMP] hack to register the wsgi handler when running embbeded in openerp-server.
bzr revid: al@openerp.com-20110909160039-6ddslilpttvhubad
Diffstat (limited to 'addons/web/__init__.py')
-rw-r--r--addons/web/__init__.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/web/__init__.py b/addons/web/__init__.py
index 343b53d050d..5a3f33f8af4 100644
--- a/addons/web/__init__.py
+++ b/addons/web/__init__.py
@@ -1,5 +1,28 @@
import common
import controllers
+import common.dispatch
+
+try:
+ import openerp
+ import os
+ import tempfile
+ print "embedded mode"
+ class Options(object):
+ pass
+ o = Options()
+ o.dbfilter = '.*'
+ o.session_storage = os.path.join(tempfile.gettempdir(), "oe-sessions")
+ o.addons_path = os.path.dirname(os.path.dirname(__file__))
+ o.serve_static = True
+ o.server_host = '127.0.0.1'
+ o.server_port = 8069
+
+ app = common.dispatch.Root(o)
+ #import openerp.wsgi
+ openerp.wsgi.register_wsgi_handler(app)
+
+except ImportError:
+ print "standalone mode"
# TODO
# if we detect that we are imported from the openerp server register common.Root() as a wsgi entry point