Skip to main content

Fandjango makes it stupidly easy to create Facebook applications with Django.

Project description

Fandjango makes it really easy to create Facebook applications with Django.


def greet(request):
    return HttpResponse('Hi, %s!' % request.facebook.user.first_name)

If you’d like to create an application that’s a little more elaborate, you should read the documentation.


$ pip install fandjango


  • Fork the repository.
  • Do your thing.
  • Open a pull request.
  • Receive cake.

I love you

Johannes Gorset made this. You should tweet me if you can’t get it to work. In fact, you should tweet me anyway.

I love Hyper

I work at Hyper with a bunch of awesome folks who are all every bit as passionate about good code as myself. If you’re using this library, we probably want to hire you.



  • Fixed a bug that caused User#permissions to only return the first permission with recent versions of the Graph API.
  • Fandjango now defaults to redirecting to HTTPS upon authorizing.


  • Fandjango now supports both applications on and Facebook for websites.


  • You may now customize where the user is redirected upon authorizing the application.
  • You may now elect to throw away the signed request instead of caching it to a cookie.
  • Fixed an issue where the signed request would be read from and saved back to the same cookie.
  • User#authorized is now only truthy for fresh signed requests.
  • All DateTime instances are now timezone-aware.
  • User details are now persisted instead of cached for 30 days.


  • Fandjango will now set request.facebook to False for invalid signed requests rather than raising an exception.
  • Fandjango now uses the latest versions of requests and facepy.


  • Fandjango will now only extend OAuth tokens that have not already been extended.


  • Fandjango will now ignore internal Facebook Errors upon attempting to extend an access token.


  • Fixed a bug that caused the ‘redirect_uri’ argument to ‘facebook_authorization_required’ to be ignored.


  • You may now set view-specific permissions.
  • Added User#permissions.
  • OAuth tokens are now extended (see Deprecation of Offline Access Permission)
  • Fixed an issue that prevented users from authorizing applications under Internet Explorer.


  • Fixed a bug that caused an AttributeError upon issuing a HTTP GET request to the deauthorization view.
  • Fixed a bug that caused application deauthorization to fail.
  • Fixed a bug that prevented the norwegian localization from being applied.


  • Fixed a bug that caused an ImportError with FANDJANGO_ENABLED_PATHS or FANDJANGO_DISABLED_PATHS.
  • Fixed a bug prevented templates from being installed.


  • User#graph no longer supports Facebook’s Python SDK.
  • User#full_name, User#url, User#gender, User#hometown, User#location, User#bio, User#relationship_status, User#political_views, User#email, User#website, User#locale, User#timezone, User#picture and User#verified are no longer persisted, but queried from Facebook and cached for 24 hours.
  • The request object’s ‘facebook’ attribute now has a ‘signed_request’ attribute that contains the result of parsing the signed request with Facepy.
  • The request object’s ‘facebook’ attribute no longer has a ‘page’ attribute with information on the Facebook page the application was loaded from.
  • Fixed a race condition that caused multiple records to be registered for the same user.
  • Users that refuse to authorize the application will now be directed to the view referenced by the FANDJANGO_AUTHORIZATION_DENIED_VIEW setting.
  • Facilitated for internationalization.
  • Fandjango is now available in Norwegian.


  • Added support for reverse-engineering signed requests.
  • Added User#middle_name, User#timezone and User#quotes.


  • Fixed a bug that produced HTTP 500, causing ‘User#picture’ to fail.
  • ‘request.POST’ is now reset to an empty QueryDict instance after overriding the request method of Facebook’s initial request from POST to GET.


  • Fixed a bug that caused a KeyError when Facebook lists the user’s hometown and location incorrectly.


  • Fixed a bug that caused a TypeError in Django’s admin for models that were linked to Fandjango’s User model.


  • You may now find an instance of your favourite Graph API client (provided your favourite is either Facepy or Facebook’s official Python SDK) initialized with the user’s access token in ‘User#graph’.
  • You may now initialize Facebook’s JavaScript SDK with the ‘facebook_init’ template tag.


  • Fixed a bug that caused endless redirection for users who have granted the application offline access.


  • Fixed a bug that caused Facebook Page profiles to raise an IntegrityError.
  • Fixed a bug that caused Facebook Page profiles to display with full name ‘None None’ in the admin.


  • Fixed a bug that caused the “facebook_authorization_required” decorator to be incompatible with Django libraries that modify the order of arguments given to views.


  • It is now possible to direct users to application authorization from templates: “{% url authorize_application %}”.
  • Fandjango now tracks whether users currently authorize the application (this requires some configuration; see the README for details).


  • The user model has been upgraded with a number of new properties: facebook_username, hometown, location, bio, relationship_status, political_views, email, website, locale, verified and birthday.
  • You may now synchronize a user instance with Facebook by calling its synchronize() method.


  • Fandjango now supports South database migrations. To enable South in an existing installation of Fandjango, run ‘python migrate fandajngo 0001 –fake’.


  • FANDJANGO_IGNORE_PATHS is now deprecated.
  • New feature: OAuthToken#expired
  • The OAuth Token model is now registered with Django’s admin.


  • HTTP POST requests made from the Facebook platform as a result of Facebook’s ‘POST to Canvas’ migration are now transparently converted to HTTP GET requests.




  • Fandjango is no longer dependant on Facebook’s Python SDK.
  • Fix ImportError exceptions introduced in 3.2.


  • Fix a bug that caused an exception when the user had not specified his/her/its first name, last name or gender.


  • Fandjango now supports Python 2.5.


  • The ‘facebook_authorization_required’ decorator now has an optional argument; ‘redirect_uri’. Note that this changes its syntax; it now requires to be suffixed by a set of parenthesis.


  • Fixed a bug that caused Fandjango to crash if no signed request was available.


  • Information previously found in ‘request.facebook_page’ and ‘request.facebook_user’ are now found in ‘’ and ‘request.facebook.user’, respectively.


  • New feature: Facebook application tabs.
  • The ‘facebook_user’ attribute of the request object is now set to ‘None’ if no signed request. is availabe, or the user has not authorized the application.


  • New feature: User#created_at.
  • New feature: User#last_seen_at.
  • New feature: User#picture.
  • Fixed a bug that prevented renewed OAuth tokens to be discarded.
  • Fandjango is now registered with Django’s admin.


  • Fix a bug that prevented the ‘facebook_user’ attribute of the request object from being set to false if no signed request was found or the user had not authorized the application.


  • Fix a bug that caused permanent OAuth tokens to have their expiry set incorrectly.


  • Facebook users that have authorized the application are now automatically registered in Fandjango’s user model.


  • Fixed a bug that caused an exception if the signed request did not contain an user ID.
  • Fixed a bug that caused the expiry time of OAuth tokens to be incorrect.


  • Fandjango now supports Facebook’s “POST to Canvas” migration.
  • FACEBOOK_APPLICATION_URI has been renamed to FACEBOOK_APPLICATION_URL for consistency.


  • Fandjango’s version number is now available in the VERSION constant.
  • Fandjango is now compatible with browsers that have JavaScript disabled.


  • Everything

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fandjango, version 4.2.1
Filename, size File type Python version Upload date Hashes
Filename, size fandjango-4.2.1.tar.gz (30.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page