Re: Trying to build a fully synthesized site
[email protected] Fri, 28 Oct 2016 17:44:34 -0700 (PDT)
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Message-ID | <[email protected]> |
Here's more info and clearer questions: I have a config that loads a set of pages and tells which variables need to be extracted from the memory state to satisfy the query. Here's what I am trying to do: Build up something that knows which pages are defined and send 404s for things not defined. If cherrypy can do that, it would be great... have a generic class/function that all the defines queries get funneled to: That wants to get instance of the page description class that was loaded from the config it looks at the page that was requested, gets the list of data that was desired and builds up the response json if there was a jinja template specified, feed the data into the template ann capture the rendered output send the response back Here are some specific questions: can I build the dispatcher at runtime? is it worth doing this or should I generate the 404s from my class/function? if I don't do a dispatcher, how do I say that everything below a point on the path is handled by the class/function? How do I pass the instance of the page description class and other things into class/function? I would assume a class is easier since it then can have private storage. I am thinking right about this? thanks in advance, jerry On Wednesday, October 26, 2016 at 2:00:18 PM UTC-7, [email protected] wrote: > > Hi, > I am completely new to CherryPy and am trying to do something different > than a typical web site. > I am using http to expose data that has be learned within a local > management tool. My config file allows the user to define a page URL and > what data is returned in a json dictionary. They can also specify a > template file (jinja2) and I will feed the data through the template to > return them the rendered result. > > So there are no specific pages that exist, so the define a class or > function for a page as in the examples doesn't seem to make any sense. I > want to tell cherrypy which pages exist and then route them all through a > single routine that looks up the page information and returns json or html. > What is the best way to do this? This is my whole reason for embedding the > server. > > I might think this could be a good addition to the FAQ, I can't be the > only person who would want to do this. > > thanks, > jerry > > > -- You received this message because you are subscribed to the Google Groups "cherrypy-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected] Visit this group at https://groups.google.com/group/cherrypy-users. For more options, visit https://groups.google.com/d/optout.