List Info

Thread: CherryNewb: can't get static content working




CherryNewb: can't get static content working
user name
2006-10-20 19:03:05
ej wrote:
> it is my expectation that this code:
> 
> cherrypy.config.update(
>     { 'server.socket_port'   : 8088,
>       'tools.staticdir.root' :
'/home/ej/proj/calibration_pages',
>     }
> )
> 
> appconfig = {
>     '/static' : { 'tools.staticdir.on'  : True,
>                   'tools.staticdir.dir' : 'static',
>                 },
> }
> 
> cherrypy.quickstart(MyFiles(), config=appconfig)
> 
> 
> Should give the same behavior as this code:
> 
> cherrypy.config.update('static2.conf')
> cherrypy.quickstart(MyFiles())
> 
> when static2.conf has this text:
> 
> [global]
> server.socket_port = 8088
> 
> [/static]
> tools.staticdir.on  = True
> tools.staticdir.dir =
"/home/ej/proj/calibration_pages/static"
> 
> 
> It does not. It seems to me that something is fishy in
parsing and
> using config files. Is it also your expectation that
these would be
> equivalent, or am I misunderstanding something?

They are not equivalent, but I think you're right that they
should be.

Index: __init__.py
============================================================
=======
--- __init__.py	(revision 1401)
+++ __init__.py	(working copy)
 -24,6
+24,7 
 
 def quickstart(root, script_name="",
config=None):
     """Mount the given app, start the engine
and builtin server, then
block."""
+    _local_config.update(config)
     tree.mount(root, script_name, config)
     server.quickstart()
     engine.start()
 -253,4
+254,4 
 
 # Set up config last so it can wrap other top-level objects
 from cherrypy import _cpconfig
-config = _cpconfig.Config()
+config = _local_config = _cpconfig.Config()


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

CherryNewb: can't get static content working
user name
2006-10-21 18:35:19
ej wrote:
> It seems to me that something is fishy in parsing and
> using config files. Is it also your expectation that
these
> would be equivalent, or am I misunderstanding
something?

and I answered:
> They are not equivalent, but I think you're right that
they should be.

And now they are: http://www.ch
errypy.org/changeset/1404.


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )