Ich habe ein kleines Problem mit Statischem Content bei CP 3.
Funktionieren tut es... aber net so, wie es soll
Folgendes funktioniert z.B. wunderbar:
Code: Alles auswählen
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import cherrypy, os, sys
from utils import render_to_response
class Root(object):
def index(self):
return render_to_response('index.txt')
index.exposed = True
root = Root()
cherrypy.tree.mount(root)
if __name__ == '__main__':
current_dir = os.path.dirname(os.path.abspath(__file__))
conf = {
'/style.css': {
'tools.staticfile.on': True,
'tools.staticfile.filename': os.path.join(current_dir, 'templates', 'style.css')
}
}
##cherrypy.config.update(os.path.join(current_dir, 'test.conf'))
cherrypy.quickstart(root, '/', config=conf)
Code: Alles auswählen
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import cherrypy, os, sys
from utils import render_to_response
class Root(object):
def index(self):
return render_to_response('index.txt')
index.exposed = True
root = Root()
cherrypy.tree.mount(root)
if __name__ == '__main__':
current_dir = os.path.dirname(os.path.abspath(__file__))
conf = {
'/style.css': {
'tools.staticfile.on': True,
'tools.staticfile.filename': os.path.join(current_dir, 'templates', 'style.css')
}
}
cherrypy.config.update(conf)
cherrypy.server.quickstart()
cherrypy.engine.start()
Oberes funktioniert ja einwandfrei ... aber letzteres sollte laut Doku (oder hab ich falsch gelesen) auch funktionieren... Tut es aber nicht :'( Er "mounted" jedenfalls '/style.css' nicht richtig bzw. gar nicht.
MfG EnTeQuAk