~jfb-tempo-consulting/unifield-web/US-9592

« back to all changes in this revision

Viewing changes to start-tinyerp.py

  • Committer: Amit Mendapara
  • Date: 2008-01-01 03:10:28 UTC
  • Revision ID: ame@tinyerp.com-e6de3f53db52a3b7d432addb20f6e5d14b41d235
* Using an entry point scripts for project start scripts (see TG-1.0.4b3).
* Changes the way eTiny loads default configuration.
* `Tiny ERP server` configuration settings have been moved to default.cfg/dev.cfg.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
 
import pkg_resources
3
 
pkg_resources.require("TurboGears")
4
 
 
5
 
from turbogears import config, update_config, start_server
6
 
import cherrypy
7
 
cherrypy.lowercase_api = True
8
 
from os.path import *
 
2
# -*- coding: UTF-8 -*-
 
3
"""Start script for the eTiny TurboGears project.
 
4
 
 
5
This script is only needed during development for running from the project 
 
6
directory. When the project is installed, easy_install will create a
 
7
proper start script.
 
8
"""
 
9
 
9
10
import sys
10
 
 
11
 
# first look on the command line for a desired config file,
12
 
# if it's not on the command line, then
13
 
# look for setup.py in this directory. If it's not there, this script is
14
 
# probably installed
15
 
if len(sys.argv) > 1:
16
 
    update_config(configfile=sys.argv[1],
17
 
        modulename="tinyerp.config")
18
 
elif exists(join(dirname(__file__), "setup.py")):
19
 
    update_config(configfile="dev.cfg",modulename="tinyerp.config")
20
 
else:
21
 
    update_config(configfile="prod.cfg",modulename="tinyerp.config")
22
 
config.update(dict(package="tinyerp"))
23
 
 
24
 
from tinyerp.controllers import Root
25
 
 
26
 
start_server(Root())
 
11
from tinyerp.commands import start, ConfigurationError
 
12
 
 
13
if __name__ == "__main__":
 
14
    try:
 
15
        start()
 
16
    except ConfigurationError, exc:
 
17
        sys.stderr.write(str(exc))
 
18
        sys.exit(1)