Installation and configuration

Fandjango is best installed with pip:

$ pip install fandjango


In your ``settings`` module...

  • Add fandjango to INSTALLED_APPS

  • Add fandjango.middleware.FacebookMiddleware to MIDDLEWARE_CLASSES

  • Add url(r'^fandjango/', include('fandjango.urls')) to your patterns.

  • Specify your Facebook application’s id, secret key and namespace:



If you’re using Django’s CSRF protection middleware, you need to make sure Fandjango’s middleware precedes it. Otherwise, Facebook’s requests to your application will qualify as cross-site request forgeries.

Finally, synchronize your database:

$ python syncdb


If you’re using South, run schema migrations instead.

Mobile/Web Middleware

Add beneath fandjango.middleware.FacebookMiddleware to support Facebook mobile apps and web based Facebook login.

Optional settings

A string describing the Facebook application’s canvas URL.
A list of regular expressions describing paths on which Fandjango should be disabled.
A list of regular expressions describing paths on which Fandjango should be enabled.
A string describing a view that will be rendered for users that refuse to authorize the application.
A list of strings describing permissions that will be requested upon authorizing the application.
Only applicable when using fandjango.middleware.FacebookWebMiddleware. Determines where to redirect user post authentication. If not set, Fandjango will attempt to construct the redirect URL automatically.


In order to install and use Fandjango, you will need five primary pieces of software:

Development dependencies

If you are interested in contributing to Fandjango, you will also need to install some or all of the following packages:

For an up-to-date list of exact testing/development requirements, including version numbers, please see the DEPENDENCIES file included with the source distribution. This file is intended to be used with pip, e.g. pip install -r DEPENDENCIES.


You may have to change your database schema when you upgrade Fandjango. Thankfully, Fandjango bundles South migrations and so upgrading your database is as simple as running python migrate fandjango.

If you’re not using South, you’re on your own.

Source code checkouts

To follow Fandjango’s development via Git instead of downloading official releases, please see our Github mirror.