Ginés Martínez Sánchez avatar Ginés Martínez Sánchez committed a5d2bee Draft

good!! multi-wsgi application done

Comments (0)

Files changed (2)

ginsfsm/examples/wsgi/multiple_wsgi_server.ini

 [composite:main]
-use = call:ginsfsm.protocols.wsgi.common.urlmap:urlmap_factory
 use = call:ginsfsm.gaplic:gaplic_factory
 main = wsgi-server
+wsgi = wsgi-application
 
 [app:wsgi-server]
 use = call:ginsfsm.examples.wsgi.multiple_wsgi_server:main
-wsgi-server.host = 0.0.0.0
-wsgi-server.port = 8000
-wsgi-server.application = composite:urlmap
+host = 0.0.0.0
+port = 8000
+application = wsgi-application
 GSock.trace_dump = true
 GObj.trace_mach = true
 
-[composite:urlmap]
+[composite:wsgi-application]
 use = call:ginsfsm.protocols.wsgi.common.urlmap:urlmap_factory
 / = application1
-/app2 = application1
-/app3 = application1
+/app2 = application2
+/app3 = application3
 
 [app:application1]
 use = call:ginsfsm.examples.wsgi.multiple_wsgi_server:paste_app_factory1

ginsfsm/examples/wsgi/multiple_wsgi_server.py

 import logging
 logging.basicConfig(level=logging.DEBUG)
 
+from ginsfsm.globals import get_global_app
 from ginsfsm.gaplic import GAplic
 from ginsfsm.protocols.wsgi.server.c_wsgi_server import GWsgiServer
-from ginsfsm.protocols.wsgi.common.urlmap import URLMap
+#from ginsfsm.protocols.wsgi.common.urlmap import URLMap
 
 
 #===============================================================
 def main(global_config, **local_conf):
     """ Entry point to run with gserve (PasteDeploy)
     """
+    if 'application' in local_conf:
+        application = local_conf.pop('application')
+    else:
+        raise Exception('You must supply an wsgi application.')
+    application = get_global_app(application)
+
     ga = GAplic('Wsgi-Example', **local_conf)
-    'wsgi-server.application'
     ga.create_gobj(
         'wsgi-server',
         GWsgiServer,
         None,
-        application=application1
+        application=application
     )
     return ga
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.