django / facebook oauth

I’ve began work setting up a facebook application using django. One of the requirements is that I’m able to hook into facebook’s authentication system.

The package below seems to be the most flexible. The others that I’ve used require much more involvement and this has access directly to the api. I’m still looking for documentation on how to use the functions, but in time I’ll figure it out.

The package does require that you use python 2.5+ so I had initial trouble trying to get working with python 2.4.3, the default CentOS python package.

    The current setup is:

  • Apache2.2
  • Mod_python 3.3.1
  • Python 2.6
  • MySQL 5.0

After I make progress with the application, I’ll share my findings.

django facebook connect

Thanks to this tutorial, I was able to work in django/facebook authentication. It is minimal and works rather well. This is just the beginning of a site that I’m working on with django as the backend to a facebook app. The link below is to the original author.

There are some basic things that will need to be done in order to make the application work the way I want to. It’s your typical run of the mill website minus the community.

How to setup Django on Slicehost

So you’re setting a new host. This should make it easier to setup on CentOS 5.5. This list isn’t complete since you will need to setup django but this should at least get the system the basic packages to start moving.

  • vim-enhanced
  • python mod_python
  • httpd
  • mysql.x86_64
  • mysql-server.x86_64
  • subversion.x86_64
  • python
  • screen
  • mlocate
  • python-devel.x86_64
  • mysql-devel.x86_64
  • gcc
  • python-setuptools.noarch

Download  Open Source packages


tar -zxvf django.1.2.tar.gz
python install

Once installed, this should make available from command line. Installation of django typically goes into /usr/lib/python2.x/site-packages/django


You will need to have the mysql-python connector to allow django/python to connect properly to the database. This of course will require MySQL server and client is installed and running on the box.

tar -xvzf MySQL-python-1.2.3c1.tar.gz
python build
python install

Apache Configurations

There are several small steps that need to be happen before django will work properly.

Django admin files have to be made available to the public.

ln -s /var/www/html/media  /usr/lib/python2.4/site-packages/django/contrib/admin/media

Setup an eggs directory for apache

mkdir /var/www/eggs

Add the following to the httpd.conf file

<Location “/”>
SetHandler python-program
PythonPath “[‘/usr/local’, ‘/var/www’] + sys.path”
PythonHandler django.core.handlers.modpython
SetEnv PYTHON_EGG_CACHE /var/www/eggs
PythonDebug On
ErrorDocument 404 /errors/404.html

<Location “/media”>
SetHandler None

At this point, you have about 80% of the work done to get django up and running from a blank host. All that needs to happen from here is to configure your and create your django application. Good luck and hope this helps!