Django - Flickr feed without sync - django

I want to show the latest 8 images from a Flickr photostream using Django. I've had a good google and the only articles I can find focus on syncing the results with a database. I'd rather not do this if possible, I just want to show the images and nothing else.
http://code.djangoproject.com/wiki/FlickrIntegration This page has some adaptable code, but the library he uses seems to be offline now.
Does anyone have any examples of how I might integrate with a flickr stream without syncing the results?

Why can't you just use the flickr API from Python? There's probably python packages to do it. All you do is get the user's photostream info, map the photos to URLS:
http://www.flickr.com/services/api/flickr.people.getPhotos.html
Then your Django template just has an <img> tag with the right URL.
Edit: python packages listed on the flickr API page:
http://stuvel.eu/flickrapi
http://code.google.com/p/flickrpy/

I made Flickr Pony for use Flickr with Django Storage API and more.
You'll only need an API KEY and launch this:
>>> from flickr_pony.storage import FlickrStorage
>>> storage = FlickrStorage(api_key="myApiKey")
>>> storage.listdir('140893176#N07')
([], ['https://farm2.staticflickr.com/1586/25309081103_518e989396_o.jpg',
'https://farm2.staticflickr.com/1623/25911906696_84c8cf31ae_o.jpg',
'https://farm2.staticflickr.com/1617/25637193860_98a08d224f_o.jpg',
...
'https://farm2.staticflickr.com/1671/25794942526_5b54c8a908_o.jpg',
'https://farm2.staticflickr.com/1653/25820730145_4040532d03_o.jpg'])

Related

How to build API that will return HTML for the site and JSON for other clients

I have started learning DRF just a while ago and had a little question -
how can I code one API that will return HTML for the site that I am currently working on and return JSON format for other "clients"(e.g. mobile apps, desktop, etc)?
I have tried to search for this information, but didn't found any answering content.
The only way I see is to create default Django views for the site and create separated API's for other requests. Can anybody tell me if I am right and need to do so, or there is some code that is solving my problem?
Ultimately, you can think of it as a whole separate set of views, urls and instead of models you have a serializer. Within you're app you can create an API folder. Within that directory you will need to have an '_ _ init _ _.py', 'urls.py', 'views.py' and a 'serializers.py'. Its analogous to creating a standard url, view, model structure to display an HTML page, but without the HTML template. Make distinct urls for the serializers too. For example for login do something like this:
path('my_app_api/login', serializer_view)
Youtube has tons of videos if you search django rest framework

How to use EXIF.py in Django photologue to extract GPSInfo from images and display it in google map

I am using Django-photologue this app to display a photo gallery, which is quite nice. But what I want to do further is extract out the GPSInfo from each image and display it on the website (or more advanced, display it in google map). I am quite a newbie to Django, so don't know how to proceed.
The way I am doing the gallery is from Django Photologue Upload Photo Example.
If you can show me some details, like how to override the models, views, urls, that would be great. And if you can suggest another app to incorporate the google map API,I really appreciate. Thanks
Django-photologue's documentation has some examples showing how you can override the admin, views, urls and models. If you try these examples, they can give you some ideas for creating your own customisations.
I am not sure how to best use EXIF.py, as I have never used it myself!

How can get images from wikipedia api?

i have the product keyword, i need images from wikipedia for that search keyword to display in my web application. is it possible? i'm doing this application in python/django framework.
Some simple searching has this example in the tutorial, for fetching search result images:
?action=query&titles=San_Francisco&prop=images&imlimit=20&format=jsonfm.
You can use urllib2 to fetch the results, etc.

Open-source Django model for Twitter

Where can I find a Django model for Twitter for caching tweets? I want to be able to capture tweets, users, etc and the relationships between them. I'd like not to have to update this things myself whenever the Twitter API changes.
Tweepy is a very good open-sourced library just for this purpose and works great in Django

Django Photologue Tutorial

I have a hard time understanding how photologue works exactly.
Is anybody aware of a Example Project Tutorial where I can display a gallery via Django-Photologue. Where Imagelinks are stored in a database?
Or how can I achieve that in Django?
Or what else is out there to create a decent Photo Display?
Thanks for the time!
The best way to get started with photologue is to start a new django project, and follow the installation instructions. Then, load up the django admin and start adding photos and creating galleries. You should be able to get a good understanding of Photologue that way.
Photologue is based around the concept of having gallerys of images with different photo sizes and effects. It's great if you want to show a gallery of images. If you are looking to intergrate images into your own apps, you might find ImageKit much more useful. I think it's based on Photologue, but instead of giving you automated photo galleries it provides hooks that you can use to do manage photos programmatically.
Here is an example project by the author of photologue:
https://github.com/jdriscoll/django-photologue/tree/master/example_project