views:

30

answers:

0

I want to run multiple facebook applications from a Django project


project\

settings.py

fbapp1\ 'needs FACEBOOK_API_KEY=KEY1

fbapp2\ 'needs FACEBOOK_API_KEY=KEY2


For Facebook authentication and APIs to work pyfacebook middleware uses conf.settings to get the FACEBOOK_API_KEY for each request and adds a Facebook object to each request ( then when view is called you can make calls to Facebook).

Problem is that there is only 1 settings.py file and 1 FACEBOOK_API_KEY variable.

Workarounds are 1. Each facebook application is different Django project 2. don't use pyfacebook as middleware and initialize facebook in view code.

Since design of Django is meant to allow multiple applications to be run and reused I am looking for help to understand how to do this with pyfacebook

  1. Is pyfacebook a poor design for Django and I should rewrite?
  2. Django doesn't have any guidelines on per project settings do they, is it all supposed to be in the db?
  3. Middleware can't tell which project will be invoked except for processview where you get view function and could in principle figure out the module where application specific FACEBOOK_API_KEY lived . Is this what I should do?

  4. What tool can I use to make copying Django facebook applications correct and not be handing out the FACEBOOK_SECRET_KEY?

  5. Is my problem not meant to be solved by Django in a common shared way?
  6. What else should be I thinking about to make this work well? Plenty of hacky solutions.