Seite 1 von 1

Python , CherryPy und Mako

Verfasst: Donnerstag 16. November 2017, 09:49
von Supersebe
Hallo an alle,

ich habe eine kleine Frage bezüglich Mako und Python.

Code: Alles auswählen

	 @cherrypy.expose
    def index(self):
        myTemplate = Template("Hello World")
        print(myTemplate.render())
Wenn ich diesen Befehl ausführen will, zeigt mir der Browser nur eine leere Seite an und in der Konsole wird mir eine Exception geworfen:
Could not load the source for http://127.0.0.1:8080/.
[Exception... "Component returned failure code: 0x80470002 (NS_BASE_STREAM_CLOSED) [nsIInputStream.available]" nsresult: "0x80470002 (NS_BASE_STREAM_CLOSED)" location: "JS frame :: resource://devtools/shared/base-loader.js -> resource://devtools/shared/DevToolsUtils.js :: onResponse :: line 482" data: no]
Stack: onResponse@resource://devtools/shared/base-loader.js -> resource://devtools/shared/DevToolsUtils.js:482:23
onStopRequest@resource://gre/modules/NetUtil.jsm:131:17
Line: 482, column: 0

Weiß jemand, wie man dieses Problem lösen kann?

MFG

Re: Python , CherryPy und Mako

Verfasst: Donnerstag 16. November 2017, 12:03
von noisefloor
Hallo,

in der Funktion fehlt das `return` Statement, d.h. die Route liefert in der Tat keine Inhalte zurück.

Gruß, noisefloor