librelist archives

« back to archive

Using app in another environment

Using app in another environment

From:
Nicolas Clairon
Date:
2010-11-03 @ 12:57
Hi all,

I'd like to know if this is possible (and safe) to use function of an
app in a another application.

I explain myself : I'd like to create 3 REST applications which return
json document :

 * blog
 * bug tracker
 * user

Those are example. For instance, I'd be able to create a blog post
using REST like this :

  /blogpost/create?title="hello"&body="world"

Those apps are flask apps and will deal with the database.

Now, I'd like to create a mashup application which will use all
previous 3 core apps to display blog post, tracker and handle users.

I could make this mashup in pure HTML5/CSS/Javascript but I'd like to
use flask to handle session jinja templates etc...

Is this possible to import all fonctions from my 3 previous app and
use them with the python way or should I use an HTTP parser to get my
docs ?

Can I do for example:

>>> from blog import get_blogposts

>>> def list_blogpost(author):
...       # will fetch all blogpost from the blog app
...       docs = get_blogpost(author=author)
...       return render_template('display_blogposts', docs=docs)

Is it safe to do this ?

N.