--- whatwhat-start.py~	2006-09-20 12:17:32.000000000 -0300
+++ whatwhat-start.py	2006-09-24 21:17:59.000000000 -0300
@@ -5,21 +5,22 @@
 import cherrypy
 import turbogears
 from os.path import *
+from os import access, R_OK
 import sys
 
-# 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
+# first use the app's configuration, then try the autogenerated
+# one, if it exists, and the use the /etc file to override the
+# configuration with the admin choices
+turbogears.update_config(modulename="whatwhat.config.app")
+for cfgfile in ["/var/cache/turbogears/whatwhat/prod.cfg",
+                "/etc/turbogears/whatwhat/prod.cfg"]:
+    if access (cfgfile, R_OK):
+        turbogears.update_config (configfile=cfgfile,
+                                  modulename="whatwhat.config")
+
 if len(sys.argv) > 1:
-    turbogears.update_config(configfile=sys.argv[1], 
-        modulename="whatwhat.config.app")
-elif exists(join(dirname(__file__), "setup.py")):
-    turbogears.update_config(configfile="dev.cfg",
-        modulename="whatwhat.config.app")
-else:
-    turbogears.update_config(configfile="prod.cfg",
-        modulename="whatwhat.config.app")
+    turbogears.update_config(configfile=sys.argv[1],
+                                  modulename="whatwhat.config")
 
 from whatwhat.controllers import Root
 
