Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How to set url id to a specific field cherrypy framework?

$
0
0

urls.py

cherrypy.tree.mount(Hello(),"/",config={})

I want to change the url to something like this..

cherrypy.tree.mount(Hello(),"/{id}",config={})

How can,

import cherrypy class Article(object):    @cherrypy.expose     def index(self):        id = cherrypy.request.params.get("id")        return f"Id: {id}"if __name__ == "__main__":    cherrypy.tree.mount(Article(),"/{id}",config={})    cherrypy.engine.start()    cherrypy.engine.block()

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>