{ "info": { "author": "Thanos Vassilakis", "author_email": "thanos@syntazo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "How to use djgoogle.picasa\r\n --------------------------\r\n \r\n \r\n I'm pretty useless at documentation so I will just guide you through \r\nhow I use these components in my web site.\r\n \r\n Prerequisites\r\n ------------\r\n \r\n Before you start you will need to install google's python api. \r\neasy_install will do that for you.\r\n \r\n Installing\r\n --------\r\n Okay lets go. Either do::\r\n easy_install django-picasa\r\n \r\n Or download the distribution file into your temp or just check out the \r\npicassa module into your project's directory. Run python setup.py::\r\n C:\temp>\r\n C:\temp>python setup.py install --install-purelib=\"C:\\your_project\"\r\n running install\r\n running build\r\n running build_py\r\n creating build\r\n creating build\\lib\r\n creating build\\lib\\picasa\r\n copying picasa\fields.py -> build\\lib\\picasa\r\n copying picasa\\storage.py -> build\\lib\\picasa\r\n copying picasa\\__init__.py -> build\\lib\\picasa\r\n running install_lib\r\n creating C:\\your_project_root\\picasa\r\n copying build\\lib\\picasa\fields.py -> C:\\your_project\\picasa\r\n copying build\\lib\\picasa\\storage.py -> C:\\your_project\\picasa\r\n copying build\\lib\\picasa\\__init__.py -> C:\\your_project\\picasa\r\n byte-compiling C:\\your_project\\picasa\fields.py to fields.pyc\r\n byte-compiling C:\\your_project\\picasa\\storage.py to storage.pyc\r\n byte-compiling C:\\your_project\\picasa\\__init__.py to __init__.pyc\r\n running install_egg_info\r\n Writing C:\\your_project_root\\djgoogle-1.0-py2.5.egg-info\r\n \r\n \r\n settings.py\r\n -----------\r\n \r\n Add the framework to the INSTALLED_APPS tuple of your projects \r\nsettings.py file::\r\n INSTALLED_APPS = (\r\n 'django.contrib.auth',\r\n 'django.contrib.contenttypes',\r\n 'django.contrib.sessions',\r\n 'django.contrib.sites',\r\n 'django.contrib.admin',\r\n 'your_project.cms',\r\n 'your_project.picasa'\r\n )\r\n \r\n \r\n Then add to the settings.py file your PICASA_STORAGE_OPTIONS::\r\n PICASA_STORAGE_OPTIONS = {\r\n 'email':'thanosv@gmail.com',\r\n 'source':'thanos',\r\n 'password':'mypassword',\r\n 'user':'thanosv',\r\n 'cache': True}\r\n \r\n Where:\r\n email is your Picasa account id.\r\n source is a string you will use to identify how the images where added \r\nto your Picasa account.\r\n user is the actual Picassa account that the images will stored in. It \r\ndoesn't have to be your account just any account you have the access to.\r\n cache is weather you want to use Django's caching back-end. Usually \r\nit's worth it.\r\n \r\n If you have set cache to true they you might want to add something like \r\nthis::\r\n CACHE_BACKEND = \"locmem://?timeout=30&max_entries=400\"\r\n \r\n models.py\r\n ---------\r\n \r\n Now you are done with the settings.py file you can replace the \r\nImageFields? with the picasa field in your models::\r\n \r\n from picasa import PicasaField\r\n class Image(models.Model):\r\n photo = PicasaField( )\r\n \r\n Try it out by uploading an image through your admin page and then visit \r\nyour Picasa account. You will see the uploaded image in your Drop Box. Added a \r\nupload_to='media'::\r\n photo = PicasaField( upload_to='media')\r\n \r\n and it will upload the file into an album called media, if the album \r\ndoesn't exist it will be created.\r\n \r\n admin.py\r\n --------\r\n \r\n The default admin representaion of your image will be handled by the \r\nAdminFileWidget which will just show the value of PicasaField.url of the \r\ncontaining web page in your Picasa account. It's useful but would be better to \r\nsee a linked thumbnail. To do that you need to override the PicasaField with \r\nPicasaAdminImageWidget. To do that import the widget in your admin.py module \r\nand add it to an formfield_overrides dictionary: :\r\n \r\n By default PicasaAdminImageWidget? generates a 64 pixel icon. The sizes \r\navailable are::\r\n class PicasaFieldFile(ImageFieldFile):\r\n SIZES = (32, 48, 64, 72, 94, 104, 110, 128, 144, 150, 160, 200, 220, \r\n288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600)\r\n \r\n You can override the class attribute SIZE to change the thumbnail's \r\nsize::\r\n class ImageWidget(PicasaAdminImageWidget):\r\n SIZE='48'\r\n \r\n class ImageAdmin(admin.ModelAdmin):\r\n formfield_overrides = {PicasaField: {'widget': ImageWidget},}\r\n \r\n views.py\r\n --------\r\n \r\n Using the above demo model here is a quick view::\r\n def images(request):\r\n return render_to_response('cms/images.html', {'images':Image.objects})\r\n \r\n Here is its corresponding template (templates/cms/images.html) ::\r\n

Image List

\r\n {% for image in images.all %}\r\n
\r\n {% endfor %}\r\n \r\n and the html it produces::\r\n \r\n

Image List

\r\n
\r\n
\r\n \r\n Different Sizes\r\n --------------\r\n \r\n Although this HTML saves your site a lot of bandwidth your images are \r\nat the mercy of the browsers resizes and when the original images are large \r\nwill still be slow to download.\r\n \r\n Changing the image source variables to indicate the size they need by \r\nusing image.photo.src_300 instead of image.photo.src gets Picasa to do the \r\nresizing and greatly speeds up the download. requesting an image of the width \r\n300 will in fact get you 320, which is the next available size up::\r\n

Image List

\r\n {% for image in images.all %}\r\n
\r\n {% endfor %}\r\n \r\n And its HTML::\r\n

Image List

\r\n
\r\n

\r\n \r\n Possible Problems\r\n ----------------\r\n \r\n If you are behind a proxy and you get the following error when you try \r\nan upload an image::\r\n gaierror at /admin/cms/image/add/\r\n (11001, 'getaddrinfo failed')\r\n \r\n Check that you have set both HTTP_PROXY and HTTPS_PROXY. HTTPS_PROXY \r\ncan usually be set to the same host as HTTP_PROXY.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.google.com/p/django-googledata/", "keywords": "picassa,storage,images,photos,django,google", "license": "Apache", "maintainer": "", "maintainer_email": "", "name": "django-picasa", "package_url": "https://pypi.org/project/django-picasa/", "platform": "ANY", "project_url": "https://pypi.org/project/django-picasa/", "project_urls": { "Homepage": "http://code.google.com/p/django-googledata/" }, "release_url": "https://pypi.org/project/django-picasa/1.3/", "requires_dist": null, "requires_python": null, "summary": "A module of django components that give you picasa storage, picasa fileds and admin fields.", "version": "1.3" }, "last_serial": 153150, "releases": { "1.3": [ { "comment_text": "", "digests": { "md5": "76e7348b2c972524a8d884d555bb287f", "sha256": "bace545313c956528f3f8204262556981a393ffa95b01a76ba888675b95f085d" }, "downloads": -1, "filename": "django_picasa-1.3-py2.5.egg", "has_sig": false, "md5_digest": "76e7348b2c972524a8d884d555bb287f", "packagetype": "bdist_egg", "python_version": "any", "requires_python": null, "size": 11776, "upload_time": "2010-02-15T23:57:19", "url": "https://files.pythonhosted.org/packages/69/f2/35c5d76bdd38612d4b3a2b564de7efac753c3bd1724bee97cc907ffcf378/django_picasa-1.3-py2.5.egg" }, { "comment_text": "", "digests": { "md5": "3e1349488f7854c1e1d97f221fe5a2ca", "sha256": "a716797668ba50d5a3746b53f88dfbe3e70289e555514d186e7b6e97571923ea" }, "downloads": -1, "filename": "django-picasa-1.3.tar.gz", "has_sig": false, "md5_digest": "3e1349488f7854c1e1d97f221fe5a2ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13754, "upload_time": "2010-02-15T23:57:40", "url": "https://files.pythonhosted.org/packages/25/f3/eb68557f0ff6b5aeb727e5d83bd75103234f7b386487767e7fadb1a3a9f0/django-picasa-1.3.tar.gz" }, { "comment_text": "", "digests": { "md5": "9e7bd6430db39a3deb8227dae9859daa", "sha256": "7ffd9e34f7cc498b104502fea135c8c56ed292204859c6d57014e1c32217fcbb" }, "downloads": -1, "filename": "django-picasa-1.3.zip", "has_sig": false, "md5_digest": "9e7bd6430db39a3deb8227dae9859daa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22396, "upload_time": "2010-02-15T23:57:30", "url": "https://files.pythonhosted.org/packages/04/1a/fbf7ebd50343edd2c5465580fd65dc209fca7b240a5872e2766a92403bd4/django-picasa-1.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "76e7348b2c972524a8d884d555bb287f", "sha256": "bace545313c956528f3f8204262556981a393ffa95b01a76ba888675b95f085d" }, "downloads": -1, "filename": "django_picasa-1.3-py2.5.egg", "has_sig": false, "md5_digest": "76e7348b2c972524a8d884d555bb287f", "packagetype": "bdist_egg", "python_version": "any", "requires_python": null, "size": 11776, "upload_time": "2010-02-15T23:57:19", "url": "https://files.pythonhosted.org/packages/69/f2/35c5d76bdd38612d4b3a2b564de7efac753c3bd1724bee97cc907ffcf378/django_picasa-1.3-py2.5.egg" }, { "comment_text": "", "digests": { "md5": "3e1349488f7854c1e1d97f221fe5a2ca", "sha256": "a716797668ba50d5a3746b53f88dfbe3e70289e555514d186e7b6e97571923ea" }, "downloads": -1, "filename": "django-picasa-1.3.tar.gz", "has_sig": false, "md5_digest": "3e1349488f7854c1e1d97f221fe5a2ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13754, "upload_time": "2010-02-15T23:57:40", "url": "https://files.pythonhosted.org/packages/25/f3/eb68557f0ff6b5aeb727e5d83bd75103234f7b386487767e7fadb1a3a9f0/django-picasa-1.3.tar.gz" }, { "comment_text": "", "digests": { "md5": "9e7bd6430db39a3deb8227dae9859daa", "sha256": "7ffd9e34f7cc498b104502fea135c8c56ed292204859c6d57014e1c32217fcbb" }, "downloads": -1, "filename": "django-picasa-1.3.zip", "has_sig": false, "md5_digest": "9e7bd6430db39a3deb8227dae9859daa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22396, "upload_time": "2010-02-15T23:57:30", "url": "https://files.pythonhosted.org/packages/04/1a/fbf7ebd50343edd2c5465580fd65dc209fca7b240a5872e2766a92403bd4/django-picasa-1.3.zip" } ] }