You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this is a bug or intended behaviour. But the following code will not return the static file in case the "catchAll" function is called by url that is nested deeper i.e. calling http://localhost:8080/abc works while calling http://localhost:8080/abc/def doesn't work and will return "No Such Resource". The "catchAll" function gets called, but doesn't return the static file. Calling an explicitly declared url path that is nested such as http://localhost:8080/another/test however works.
from twisted.web.static import File
from klein import Klein
app = Klein()
@app.route('/<path:path>') # <- doesn't work if url is nested deeper
def catchAll(request, path):
print(path)
return File("./test.html")
@app.route("/test") # <- works
def test(request):
return File("./test.html")
@app.route("/another/test") # <- works
def test2(request):
return File("./test.html")
app.run("localhost", 8080)
The text was updated successfully, but these errors were encountered:
I am not sure if this is a bug or intended behaviour. But the following code will not return the static file in case the "catchAll" function is called by url that is nested deeper i.e. calling
http://localhost:8080/abc
works while callinghttp://localhost:8080/abc/def
doesn't work and will return "No Such Resource". The "catchAll" function gets called, but doesn't return the static file. Calling an explicitly declared url path that is nested such ashttp://localhost:8080/another/test
however works.The text was updated successfully, but these errors were encountered: