Daily Archives: June 3, 2007

Setting up a Django photo gallery

At this months Python West Midlands User Group meeting we looked at how we could put up a gallery for conference photographs. One team looked at django and another looked at other solutions. Since I have already played with django I opted to look at that.

The gallery we looked at was stockphoto by Jason McBrayer – http://carcosa.net/jason/software/django/stockphoto/

Installing it isn’t too bad once you’ve remembered how your django is setup ;) Luckily Alex was also trying to install the django stuff so he was able to help with bits I didn’t know or forgot. Then it needs styling and modifying.

Installation –

  • Have Django installed already!
  • Install the stockphoto using the setup.py
  • Install markdown if you don’t already have it. It’s available at http://www.freewisdom.org/projects/python-markdown/. The setup.py isn’t executable because it won’t run from the command line. You need to run it with python, like python setup.py install.
  • Patch Django using ticket 2070 as the stockphoto readme recommends
  • Create your site using django-admin.py startproject
  • Create a template/stockphoto directory.
  • Edit your settings.py file,
  • ADMIN_URL should be set if your url root isn’t /
  • MEDIA_ROOT needs to point to where the photos will go. This should be writeable.
  • MEDIA_URL url for the photos directory
  • TEMPLATE_DIRS – add the template/stockphoto directory
  • INSTALLED_APPS – add django.contrib.admin, django.contrib.markup and stockphoto
  • STOCKPHOTO_URL – should be set if your url root isn’t /
  • Setup the auth pages for login etc. If your paths aren’t based in / you may have to hack the stockphoto templates. I have in a reasonably sensible way I think. Once I have all of the work completed I’ll post a patch.

I’ve now got the basic application up and running so I have a decent idea of what it does and doesn’t do. I think the things we would have to look at improving are,

  • Add a delete photo feature. Ideally allowing bulk deletion as well for administrators
  • Make sure the adding/editing photos interface is consistent. I haven’t set everything up yet so I’m not sure exactly what needs doing but I’m guessing that that will need some work.
  • Create a style that looks good. There are no stylesheets attached to mine right now so it looks rough!
  • The import facility appears to be broken. I probably also need to add the settings path for the large downloads.

Are there any other features that would be needed specifically?

Follow

Get every new post delivered to your Inbox.

Join 64 other followers