Thank you, Jonathan! Excellent reply, and very helpful!

On Tuesday, March 27, 2012 8:27:50 AM UTC-6, Jonathan Vanasco wrote:
>
> Do you mean a JSON web API?  If so , sounds like you're talking about 
> a Service Oriented Architecture. 
>
> To be honest, the *easiest* JSON APIs i've ever written were in Pylons/ 
> Pyramid.  You have full control of the request, and all you need to do 
> is return a dict from a view/handler that is decorated to render 
> json(p). 
>
> In terms of your app structure: 
>
> 1) The @view_config decorator is pretty powerful and lets fine-tune 
> the scenarios in which a view is rendered.  ( I wanted to write 
> 'context' in there, but there is an argument to the constructor called 
> 'context' with a pyramid-specific meaning ).  You could conceivably 
> have a single codebase that just responds with different templates and 
> available methods. 
>
> 2) I wouldn't have Pyramid call a Web API to process the data quite 
> yet.  That's typically something you do at scaling time because it has 
> quite a bit of overhead in administration and maintenance.  I'd 
> probably just construct the public web-based API methods to wrap some 
> helper functions into a package in app/lib that does the real work -- 
> and which the webapp directly calls as well -- having them return 
> dicts.  when you're ready to scale, you just have to change where you 
> request the dicts -- or how they're generated. 
>
> There are a handful of posts in this list and stackoverflow that talk 
> about customizing views for devices. 
>
>
>
> On Mar 26, 6:42 pm, Day-V <da...@daveyharding.com> wrote: 
> > I'm learning python with pyramid and MongoDB. I have prior code 
> > experience, so learning Python has been really easy (love it!), the 
> > documentation for Pyramid is incredible as well. 
> > 
> > In summary, I want to build a python-based API which performs all 
> > tasks and responds with JSON objects, and then use pyramid to connect 
> > to the python-based API for I/O. Depending on device-type, I would use 
> > different views. 
> > 
> > My goal is to write a set of functions making up an API for my 
> > application. Using Pyramid I would like to be able to build separate 
> > front-ends that access the same, single API, so that I'm writing 
> > functionality into one python-based core, and just returning views 
> > that are applicable to whatever device type is accessing (phone, 
> > tablet, computer). 
> > 
> > Can anyone provide me with tips for the best way to accomplish this, 
> > or links to any blog or forum posts that may already cover this? 
> > 
> > Thanks for your help! 
> > Davey

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/rE_aEytNjngJ.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to