Here is a modified start-tinyerp.py that allows you to run it from anywhere.  
You have to set one variable inside the file for the location of the config 
files and after doing that it will work.

#!/usr/bin/python
import pkg_resources
pkg_resources.require("TurboGears")

from turbogears import update_config, start_server
import cherrypy
cherrypy.lowercase_api = True
import sys
import os
from os import *
from os.path import *
from distutils.sysconfig import get_python_lib

# configdir IS THE ONLY SETTING YOU NEED TO MAKE
configdir        = "/usr/share/doc/eTiny-0.0.1"

devpathelements  = [ configdir, "dev.cfg" ]
devconfigfile    = "/".join(devpathelements)

prodpathelements = [ configdir, "prod.cfg" ]
prodconfigfile   = "/".join(prodpathelements)

# we chdir to site-packages directory prior to starting server
chdir(get_python_lib())

# first look on the command line for a desired config file,
# if it's not on the command line, then
# look for setup.py in this directory. If it's not there, this script is
# probably installed
if len(sys.argv) > 1:
    update_config(configfile=sys.argv[1], 
modulename="tinyerp.config")
elif 
os.path.exists(dirname(__file__).join("setup.py")):
    
update_config(configfile=devconfigfile,modulename="tinyerp.config")
else:
    
update_config(configfile=prodconfigfile,modulename="tinyerp.config")

from tinyerp.controllers import Root

start_server(Root())

Gerry





_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman/listinfo/tinyerp-users

Reply via email to