The thing is that my app is accessible at the root of my webserver and
I would like to mount it to some other location. I'm currently
accessing my app as:
and would like to change it to:
so I can later deploy other applications:
http://ozdev/app2/
http://ozdev/app3/
but mostly because there are other things already running on this
server.
This is my httpd.conf:
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@ozdev
ServerSignature Off
AddDefaultCharset utf-8
<Location />
SetHandler python-program
PythonHandler modpython_gateway::handler
PythonOption wsgi.application cherrypy._cpwsgi::wsgiApp
PythonFixupHandler ccleads.ccleads_modpython
PythonDebug on
</Location>
Alias /static "D:/OZ/Projects/ccleads/ccleads/static"
Alias /favicon.ico
"D:/OZ/Projects/ccleads/ccleads/static/images/favicon.ico"
<Location /static>
SetHandler None
</Location>
<Directory "D:/OZ/Projects/ccleads/ccleads/static">
AllowOverride None
Options -ExecCGI -Indexes -Multiviews +FollowSymLinks
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Oh yes, it is an intranet app running on XP box so I have free hands to
do whatever is necessary.
Thanks,
Tvrtko
cploaded = False
def fixuphandler(req):
global cploaded
if not cploaded:
cherrypy.tree.mount(Root(), "/ccleads")
cherrypy.server.start(init_only=True, server_class=None)
cploaded = True
...and you should then change your VirtualHost's Location element to
/ccleads as well (instead of "/").
Robert Brewer
System Architect
Amor Ministries
fuma...@amor.org
I'll certanly try this. Gotta go out and walk a little.
Tvrtko
import cherrypy
import turbogears
turbogears.update_config(
configfile = r"D:\OZ\Projects\ccleads\dev_apache.cfg",
modulename = "ccleads.config.app")
from ccleads.controllers import Root
#cherrypy.root = Root()
cherrypy.tree.mount(Root(), turbogears.config.get('server.mount_point',
None))
cherrypy.server.start(initOnly=True, serverClass=None)
def fixuphandler(req):
return 0
------------
I have server.mount_point="/ccleads" inside my dev.cfg config file.
Now I have the following issues:
1. All my links inside web files (kid, js, css) have to take this new
mount point into account. This is not hard to do for kid files. I have
to use tg.url(). Certanly I loose some of the cimplicity and ease of
design (Dreamweaver can nicely show images when you use
/static/images/img.gif syntax, but not when you use tg.url()) but I'm
still able to make it work. Bigger problem is with JS and CSS files
where I can't use tg.url().
Currently the site looks just nice (styled) but only because there is
/static directory served by Apache directly from my ccleads/static
folder. This makes me wonder how to separate static content from
multiple sites and not just controllers? I think I know kow to make
apache Alias but I'm not sure how to design my CSS and JS files.
My next issues are with Identity:
2. I had to comment out all identity code from my templates because of
this:
File "d:\oz\projects\ccleads\ccleads\templates\master.py", line 147,
in _match_func
yield (START, current)
File
"c:\python24\lib\site-packages\TurboGears-0.9a2-py2.4.egg\turbogears\identity\__init__.py",
line 50, in __getattr__
identity= self.identity()
File
"c:\python24\lib\site-packages\TurboGears-0.9a2-py2.4.egg\turbogears\identity\__init__.py",
line 43, in identity
raise IdentityManagementNotEnabledException()
IdentityManagementNotEnabledException: An attempt was made to use a
facility of the TurboGears Identity Management framework but identity
management hasn't been enabled in the config file [via identity.on].
As you can guess, this works if I mount my app to server root.
I also had to comment out all @identity.require decorators because of
the same issue, only this time without a traceback but with "login"
page which says (An attempt was made to use a facility of the
TurboGears Identity Management framework but identity management hasn't
been enabled in the config file [via identity.on].) This message comes
from cherrypy.request.identity_errors which I display on login page.
3. I had to change app.cfg configuration and say:
identity.failure_url="/ccleads/login"
to make login page appear. Now, app.cfg should not be modified during
deployment so it is my guess that Identity doesn't do a right thing
with this key. I tried to change the line which uses that url:
identity/exceptions.py:
- cherrypy.InternalRedirect.__init__(self, url)
+ cherrypy.InternalRedirect.__init__(self, turbogears.url(url))
but it didn't help. I guess it has to do with InternalRedirect (usually
I use HTTPRedirect which works).
Tvrtko Sokolovski
Kevin
--
Kevin Dangoor
TurboGears / Zesty News
email: k...@blazingthings.com
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com