goa/skel/main.py
changeset 2485 ae74b46ea96c
parent 2476 1294a6bdf3bf
child 2650 18aec79ec3a3
equal deleted inserted replaced
2484:7e9283731db8 2485:ae74b46ea96c
     1 """module defining the root handler for a lax application. You should not have
     1 """module defining the root handler for a lax instance. You should not have
     2 to change anything here.
     2 to change anything here.
     3 
     3 
     4 :organization: Logilab
     4 :organization: Logilab
     5 :copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     5 :copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     7 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     7 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     8 """
     8 """
     9 __docformat__ = "restructuredtext en"
     9 __docformat__ = "restructuredtext en"
    10 
    10 
    11 # compute application's root directory
    11 # compute instance's root directory
    12 from os.path import dirname, abspath
    12 from os.path import dirname, abspath
    13 APPLROOT = dirname(abspath(__file__))
    13 APPLROOT = dirname(abspath(__file__))
    14 
    14 
    15 # apply monkey patches first
    15 # apply monkey patches first
    16 from cubicweb import goa
    16 from cubicweb import goa
    17 goa.do_monkey_patch()
    17 goa.do_monkey_patch()
    18 
    18 
    19 # get application's configuration (will be loaded from app.conf file)
    19 # get instance's configuration (will be loaded from app.conf file)
    20 from cubicweb.goa.goaconfig import GAEConfiguration
    20 from cubicweb.goa.goaconfig import GAEConfiguration
    21 GAEConfiguration.ext_resources['JAVASCRIPTS'].append('DATADIR/goa.js')
    21 GAEConfiguration.ext_resources['JAVASCRIPTS'].append('DATADIR/goa.js')
    22 config = GAEConfiguration('toto', APPLROOT)
    22 config = GAEConfiguration('toto', APPLROOT)
    23 
    23 
    24 # dynamic objects registry
    24 # dynamic objects registry
    27 
    27 
    28 # trigger automatic classes registration (metaclass magic), should be done
    28 # trigger automatic classes registration (metaclass magic), should be done
    29 # before schema loading
    29 # before schema loading
    30 import custom
    30 import custom
    31 
    31 
    32 # load application'schema
    32 # load instance'schema
    33 vreg.schema = config.load_schema()
    33 vreg.schema = config.load_schema()
    34 
    34 
    35 # load dynamic objects
    35 # load dynamic objects
    36 vreg.load(APPLROOT)
    36 vreg.load(APPLROOT)
    37 
    37 
    38 # call the postinit so custom get a chance to do application specific stuff
    38 # call the postinit so custom get a chance to do instance specific stuff
    39 custom.postinit(vreg)
    39 custom.postinit(vreg)
    40 
    40 
    41 from cubicweb.wsgi.handler import CubicWebWSGIApplication
    41 from cubicweb.wsgi.handler import CubicWebWSGIApplication
    42 application = CubicWebWSGIApplication(config, vreg=vreg)
    42 application = CubicWebWSGIApplication(config, vreg=vreg)
    43 
    43