librelist archives

« back to archive

common url handlers?

common url handlers?

From:
kevin
Date:
2011-08-13 @ 23:30
i have subdomain based application set up like this:

http://pastie.org/2366781

app_a and app_b are independent of each other, but i have common url
handlers in one file. how do i share it with these two subapps?


common.py
def channel():
 return 'common channel'



for example i want /channel to be handled by common.channel function. there
is a lot of common urls like this.
what is the best way to set this up in flask?

thanks!

Re: [flask] common url handlers?

From:
Alex Morega
Date:
2011-08-14 @ 04:43
On Aug 14, 2011, at 2:30 AM, kevin wrote:

> app_a and app_b are independent of each other, but i have common url 
handlers in one file. how do i share it with these two subapps?

Try putting the common views into a Blueprint, and register the Blueprint 
with each of the two apps.

http://flask.pocoo.org/docs/blueprints/

Cheers,
-- Alex