This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
How to use djgoogle.picasa

I'm pretty useless at documentation so I will just guide you through
how I use these components in my web site.


Before you start you will need to install google's python api.
easy_install will do that for you.

Okay lets go. Either do::
easy_install django-picasa

Or download the distribution file into your temp or just check out the
picassa module into your project's directory. Run python
C: emp>
C: emp>python install --install-purelib="C:\your_project"
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\picasa
copying picasa -> build\lib\picasa
copying picasa\ -> build\lib\picasa
copying picasa\ -> build\lib\picasa
running install_lib
creating C:\your_project_root\picasa
copying build\lib\picasa -> C:\your_project\picasa
copying build\lib\picasa\ -> C:\your_project\picasa
copying build\lib\picasa\ -> C:\your_project\picasa
byte-compiling C:\your_project\picasa to fields.pyc
byte-compiling C:\your_project\picasa\ to storage.pyc
byte-compiling C:\your_project\picasa\ to __init__.pyc
running install_egg_info
Writing C:\your_project_root\djgoogle-1.0-py2.5.egg-info

Add the framework to the INSTALLED_APPS tuple of your projects file::

Then add to the file your PICASA_STORAGE_OPTIONS::
'cache': True}

email is your Picasa account id.
source is a string you will use to identify how the images where added
to your Picasa account.
user is the actual Picassa account that the images will stored in. It
doesn't have to be your account just any account you have the access to.
cache is weather you want to use Django's caching back-end. Usually
it's worth it.

If you have set cache to true they you might want to add something like
CACHE_BACKEND = "locmem://?timeout=30&max_entries=400"

Now you are done with the file you can replace the
ImageFields? with the picasa field in your models::

from picasa import PicasaField
class Image(models.Model):
photo = PicasaField( )

Try it out by uploading an image through your admin page and then visit
your Picasa account. You will see the uploaded image in your Drop Box. Added a
photo = PicasaField( upload_to='media')

and it will upload the file into an album called media, if the album
doesn't exist it will be created.

The default admin representaion of your image will be handled by the
AdminFileWidget which will just show the value of PicasaField.url of the
containing web page in your Picasa account. It's useful but would be better to
see a linked thumbnail. To do that you need to override the PicasaField with
PicasaAdminImageWidget. To do that import the widget in your module
and add it to an formfield_overrides dictionary: :

By default PicasaAdminImageWidget? generates a 64 pixel icon. The sizes
available are::
class PicasaFieldFile(ImageFieldFile):
SIZES = (32, 48, 64, 72, 94, 104, 110, 128, 144, 150, 160, 200, 220,
288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600)

You can override the class attribute SIZE to change the thumbnail's
class ImageWidget(PicasaAdminImageWidget):

class ImageAdmin(admin.ModelAdmin):
formfield_overrides = {PicasaField: {'widget': ImageWidget},}

Using the above demo model here is a quick view::
def images(request):
return render_to_response('cms/images.html', {'images':Image.objects})

Here is its corresponding template (templates/cms/images.html) ::
<h2>Image List</h2>
{% for image in images.all %}
<a href="{{}}"><img src="{{}}"
{% endfor %}

and the html it produces::

<h2>Image List</h2>
<a href="
Media04#5434869420740374642"><img src="
S2yI8Wfc8HI/AAAAAAAAAdQ/xrYdkgQF8r0/itunesscreenshot.jpg" width="300"/></a><br/>
<a href="
Media04#5435910379245055122"><img src="
S3A7sHHCrJI/AAAAAAAAAdw/QMY9OIviHB0/thanos.jpg" width="300"/></a><br/>

Different Sizes

Although this HTML saves your site a lot of bandwidth your images are
at the mercy of the browsers resizes and when the original images are large
will still be slow to download.

Changing the image source variables to indicate the size they need by
using instead of gets Picasa to do the
resizing and greatly speeds up the download. requesting an image of the width
300 will in fact get you 320, which is the next available size up::
<h2>Image List</h2>
{% for image in images.all %}
<a href="{{}}"><img src="{{}}"
{% endfor %}

And its HTML::
<h2>Image List</h2>
<a href="
Media04#5434869420740374642"><img src="
S2yI8Wfc8HI/AAAAAAAAAdQ/xrYdkgQF8r0/s320/itunesscreenshot.jpg" width="300"/></
<a href="
Media04#5435910379245055122"><img src="
S3A7sHHCrJI/AAAAAAAAAdw/QMY9OIviHB0/s320/thanos.jpg" width="300"/></a><br/>

Possible Problems

If you are behind a proxy and you get the following error when you try
an upload an image::
gaierror at /admin/cms/image/add/
(11001, 'getaddrinfo failed')

Check that you have set both HTTP_PROXY and HTTPS_PROXY. HTTPS_PROXY
can usually be set to the same host as HTTP_PROXY.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_picasa-1.3-py2.5.egg (11.8 kB) Copy SHA256 Checksum SHA256 any Egg Feb 15, 2010
django-picasa-1.3.tar.gz (13.8 kB) Copy SHA256 Checksum SHA256 Source Feb 15, 2010 (22.4 kB) Copy SHA256 Checksum SHA256 Source Feb 15, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting