I'm trying to move my site over to dreamhost, and I've followed the
directions on the trac, with the deviation being that I went with SVN
for identity's sake. I'm working with 518 on dreamhost. It's getting
confused about the new style of config files. Here's the error:
file: /home/mikez0r/elementarycatastrophe.com/devcfg.py, line: 6
'def configure():\n'
Traceback (most recent call last):
File "tg_fastcgi.fcgi", line 21, in ?
class VirtualPathFilter(object):
File "tg_fastcgi.fcgi", line 74, in VirtualPathFilter
tg_init()
File "tg_fastcgi.fcgi", line 58, in tg_init
cherrypy.config.update(file=join(code_dir,"devcfg.py"))
File
"/home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta
-py2.4.egg/cherrypy/config.py", line 71, in update
updateMap.update(dict_from_config_file(file))
File
"/home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta
-py2.4.egg/cherrypy/config.py", line 221, in dict_from_config_file
configParser.read(configFile)
File
"/home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta
-py2.4.egg/cherrypy/config.py", line 209, in read
self._read(fp, filename)
File "/home/mikez0r/lib/lib/python2.4/ConfigParser.py", line 462, in
_read
raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section
headers.
file: /home/mikez0r/elementarycatastrophe.com/devcfg.py, line: 6
'def configure():\n'
(END)
Any ideas on what to change where to resolve this?
Thanks,
Mike
cherrypy.config.update() doesn't work with the new config files
(because they're no longer INI format files. (From the def
configure(), that would seem to imply that these are last week's
format as opposed to this week's format... which should still work,
but it's not as pretty.)
You want to use turbogears.update_config:
update_config(configfile=None, modulename=None)
Updates the system configuration either from a Python
config file, a module name specified in dotted notation or
both. If both are specified, the module
is called first, followed by the config file.
These modules define a PathConfig compatible file. That is,
they should either be INI-esque or provide a configure
function.
Generally, you'll call it like this:
turbogears.update_config(configfile="abs/path/to/prodcfg.py",
modulename="yourpackage.config")
Kevin
import turbogears
And replace this:
if exists(join(code_dir, "setup.py")):
cherrypy.config.update(file=join(code_dir, "dev.cfg"))
else:
cherrypy.config.update(file=join(code_dir, "prod.cfg"))
With this:
if exists(join(dirname(__file__), "setup.py")):
turbogears.update_config(configfile=join(code_dir,
"devcfg.py"),
modulename="<project_name>.config")
else:
turbogears.update_config(configfile=join(code_dir,
"prodcfg.py"),
modulename="<project_name>.config")
NOTE: Make sure to replace <project_name> with your project name.
I've just upgraded my TG Dreamhost install from 0.88 to the latest SVN
version, but am in the process of debugging another issue with the new
install. I'll send another note when I've figured out my other issue
since it seems like it's related to the tg_fastcgi script.
Since I wrote the original instructions, I guess I should also update
TRAC when everything is working correctly.
Thanks,
Sean
tg_fastcgi.fcgi:
The VirtualPathFilter class can be completely removed. This line
(towards the bottom) also needs to be removed:
Root._cpFilterList = [VirtualPathFilter()]
Next, change:
cherrypy.config.update({
'global': {'server.environment': 'production'},
'/': {'virtualPathFilter.on': True,
'virtualPathFilter.prefix': "/tg_fastcgi.fcgi"
}})
To:
cherrypy.config.update({
'global': {'server.environment': 'production'}})
Finally, add the following to your dev/prod config file:
server.webpath="/tg_fastcgi.fcgi"
You will have to kill all of the tg_fastcgi.fcgi processes that are
running before the changes will work. Take a look at the Dreamhost
instructions if you need info on how to do this. The fcgi processes
tend to respawn after being killed, so you'll have to double-check the
active processes to make sure that they are really gone.
Also, it seems to take about 5 min on average for the DH servers to
reload the new configuration after the fcgi processes have been killed,
so be patient.
Thanks,
Sean
> Ok, I finally got everything working. In addition to the changes
> posted above, you'll need to do the following to get the SVN version of
> TG to work:
Sean,
I believe there's a Trac entry on that and it contains a recipe... Could you
update it when TG's trac is back? It would be really helpful for other people
using DH...
--
Jorge Godoy <jgo...@gmail.com>
-Mike