Getting django-syncr running on WebFaction

I’m working on a Django installation at WebFaction that will be needing the special magnificence that is django-syncr. It’s got a few other dependencies, so I thought I’d record the steps I needed to take to get it up and running.

ElementTree

You don’t need this unless you’re using Python 2.4 or earlier, but if you do: http://effbot.org/zone/element-index.htm

django-tagging

Get it here: http://code.google.com/p/django-tagging/

OR…. just easy_install it :). I’m on Python 2.5, so SSH into your server and:

easy_install-2.5 django-tagging

God bless setuptools.

python-twitter

If you want to get your Twitter feed into your Django database, you’re gonna need python-twitter. And for python-twitter, you’re gonna need simplejson. Let’s get that first. If you’re still SSH’d in:

easy_install-2.5 simplejson

Now for python-twitter:

easy_install-2.5 python-twitter

Do you want the Flickr support?

Flickr won’t release the actual photo or allow it to be embedded using the API (as far as I can tell). I don’t really see any need for all the Flickr metadata to live in my database without the image, so I’m skipping it.

Installing django-syncr itself

django-syncr isn’t in PyPI yet, so we’ll have to download and install it the old-fashioned setuptools way:

cd ~/webapps/djangoapp/
mkdir src
cd src
svn checkout http://django-syncr.googlecode.com/svn/trunk/ syncr
cd ..
easy_install-2.5 src/syncr

I pulled up out of the ‘src’ directory so easy_install would no exactly what ‘syncr’ I was talking about.

Including django-syncr in your Installed Apps

You’ll need to edit your settings.py file to tell django you’d like to use the new apps you just easy_installed. Get to your settings.py file and open it with your favorite editor:

cd ~/webapps/djangoapp/myproject/
emacs settings.py

Added the following lines (between the ellipses) to your ‘INSTALLED_APPS’:

INSTALLED_APPS = (
    ...
    'tagging',
    'syncr.youtube',
    'syncr.twitter',
    ...
)

In my particular case, I’ve added it after a bunch of Satchmo stuff but before my own app.

Syndb and restart

That’s it for the tricky stuff. If you’ve done everything right you should be able to sync the database no problem (now is a great time to back up your data, by the way):

python2.5 manage.py syncdb

Then restart your server…

../apache2/bin/restart

and check your admin site for the new tables.

Leave a Reply

Your email address will not be published.

*
= 5 + 3