Facebook is changing their authentication flow. Expect Django Facebook to upgrade in the coming week. You will need to upgrade to a new version of Django Facebook to keep things working. Read more about the changes here: http://developers.facebook.com/blog/post/499/ http://developers.facebook.com/roadmap/ (migrations) http://developers.facebook.com/docs/authentication/ Their migration is now scheduled for September 1st so we still have some time :)
Please contribute code :)
This project is actively maintained and I appreciate improvements to the code.
Contact me here or @tschellenbach
New in Version 3.2
- Facebook_required Decorator (see http://www.mellowmorning.com/)
About Django Facebook
Django Facebook allows you to connect to the Facebook Open Graph API. Integrated with Django it becomes easy to setup a login/register via Facebook flow for your users.
- Access the Facebook API, from:
- Facebook canvas pages (For building facebook applications)
- Mobile (Or any other flow giving you a valid access token)
Django User Registration (Convert Facebook user data into a user model)
Use Facebook data to register a user with your Django app. Facebook connect using the open graph API.
Facebook FQL access
- Django registration (required for the connect flow)
- Django 1.3
TODO (again help is appreciated!)
- Implement the connect flow as a more extensible object
- Write a facebook_connect_required decorator
Tests are run from within the example project. You can run them yourself as follows:
install from git
facebook_example/manage.py test django_facebook
Download the source code or use
pip install django_facebook.
Create a Facebook App
In case you don't yet have a facebook app. You need an app to use the open graph api and make the login process work. You can create a facebook app at this url: http://www.facebook.com/developers/createapp.php
Define the following settings in your settings.py file:
Url config, context processor, auth backend
add django facebook to your installed apps:
add this line to your url config:
add this line to your context processors (
add this to your
Update your models
An abstract model is specified for convenience django_facebook/models.py FacebookProfileModel. You'll need to copy these fields into your UserProfile model, together with the post_facebook_registration function included in the model
Check the example
Right now you should have a working registration/connect/login in flow available at /facebook/connect/ Test if everything is working and ensure you didn't miss a step somewhere.
Another common issue are the url matching settings from Facebook. Facebook requires you to fill in a domain for your application. In order for things to work with local development you need to use the same domain. So if you production site is www.mellowmorning.com you should run your development server on something like local.mellowmorning.com in order for facebook to allow authentication.
If you encounter any difficulties please open an issue.
Customize and integrate into your site
This is the hardest step of the install. For an example you can look at connect.html in the templates directory.
'fb-root' div somewhere on your page. (See the example).
Do you also see the beauty in clean code? Are you experienced with high scalability web apps? Currently we're looking for additional talent over at our Amsterdam office. Feel free to drop me a line at my personal email for more information: thierryschellenbach[at]gmail.com