ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/WEBTOOLS/cmsWeb.py
Revision: 1.3
Committed: Fri Mar 30 16:23:29 2007 UTC (18 years, 1 month ago) by eulisse
Content type: text/x-python
Branch: MAIN
CVS Tags: V01-00-11, V01-00-10, V01-00-09, V01-00-08, V01-00-07, V01-00-06, V01-00-05, V01-00-04, V01-00-03, V01-00-02, V01-00-01, V1_00_00, WEBTOOLS_1_0_0_pre1, V00-09-08, V00-09-07, V00-09-06, V00-09-05, V00-09-04, V00-09-03, V00-09-02, V00-09-01
Changes since 1.2: +6 -0 lines
Log Message:
* Typo. cmsWeb.py in place of cmsWeb.
* Cfg service added to the configuration with the location of the actual installation.
* SiteDB templates are installation location indipendent.
* cmsWeb uses python -m to locate cmsWeb.py .

File Contents

# User Rev Content
1 eulisse 1.1 #!/usr/bin/env python
2     from Framework import BonsaiServer
3 eulisse 1.2 from Framework import Context
4     from optparse import OptionParser
5     from Framework import CmdLineArgs
6 eulisse 1.1
7 eulisse 1.3 class Cfg:
8     def __init__ (self):
9     # TODO: make it a property.
10     self.installRoot = __file__.rsplit ("/", 1)[0]
11    
12 eulisse 1.1 if __name__ == '__main__':
13 eulisse 1.2 context = Context ()
14     context.addService (OptionParser ())
15     context.OptionParser ().add_option ("--profile",
16     help="start server in profiler mode",
17     default=False,
18     action="store_true",
19     dest="profile")
20    
21     context.OptionParser ().add_option ("--base-url",
22     help="Base URL for the server (for usage behind a proxy).",
23     default="http://localhost:8030",
24     dest="baseUrl")
25    
26     app = BonsaiServer (context)
27    
28     opts, args = context.OptionParser ().parse_args ()
29     context.addService (CmdLineArgs (context.OptionParser ()))
30 eulisse 1.3 context.addService (Cfg ())
31 eulisse 1.2
32     if opts.profile:
33     import pstats
34     try:
35     import cProfile as profile
36     except ImportError:
37     import profile
38     profile.run ('app.start ()', 'bonsaiProfiler')
39    
40     p = pstats.Stats('bonsaiProfiler')
41     p.strip_dirs().sort_stats(-1).print_stats()
42     else:
43     app.start ()