1👍
✅
The problem appears to be with reloader. The following code works if run in integrated dev server (with command python code.py
):
import web
web.config.debug = False # turns off the reloader
class subappcls:
def GET(self):
return "This will also be shown fine"
sub_mappings = (
"/subpath", subappcls
)
#subclass web app
subwebapp = web.application(sub_mappings, globals())
#mapped class
class mapped_cls:
def GET(self):
return "this mapped sub app will not be found"
#Here I add mappings:
subwebapp.add_mapping("/mapped_sub_path", mapped_cls)
class appcls:
def GET(self):
return "main app"
main_mappings = (
"/subapp", subwebapp,
"/app", appcls,
)
mainwebapp = web.application(main_mappings, globals())
class indexcls:
def GET(self):
return "this will be shown just fine"
mainwebapp.add_mapping("/another", indexcls)
if __name__ == "__main__":
mainwebapp.run()
else:
application = mainwebapp.wsgifunc()
Running curl:
curl http://localhost:8080/subapp/mapped_sub_path
this mapped sub app will not be found
Source:stackexchange.com