Re: Trying to build a fully synthesized site
Tim Roberts <[email protected]> Fri, 28 Oct 2016 10:37:15 -0700
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Organization | Providenza & Boekelheide, Inc. |
| Message-ID | <[email protected]> |
[email protected] wrote: > > 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. At some top level, you must have some common URL root that identifies your service. For example: http://mysite.com/localmgmt/other/data?additional=data http://mysite.com/localmgmt/some/pages?other=info If everything starts with "localmgmt", then that's what you need to mount in your CherryPy tree. The rest of the URL arrives in cherrypy.request.path_info, and you can parse that in whatever way you'd like. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- 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.