Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7641021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:49:05+00:00 2026-05-31T08:49:05+00:00

I’ve been using Django for a couple of days & setup a basic blog

  • 0

I’ve been using Django for a couple of days & setup a basic blog from a tutorial with django comments.

I’ve got a totally separate python script that generates screenshots and uploads them to Amazon S3, now I’d like my django app to display all the images in the bucket and use a comment system on the images. Preferably I’d do this by just storing the URLs in my sqlite db, which I’ve got hard-coded currently to display all images in the db and has comments enabled on these.

My model:

(Does this need a foreign key to the django comments or is that just part of the Django Magic?!)

class Image(models.Model):
imgUrl=models.CharField(max_length=200)
meta=models.CharField(max_length=300)
def __unicode__(self):
    return self.imgUrl

My bucket structure:
https://s3-eu-west-1.amazonaws.com/bucket/revision/process/images.png

Almost all the tutorials and packages I’m finding are based on upload/download rather than a simple for keys in bucket type approach that I want.

One of my problems is understanding how I can integrate my Boto functions with Django if I’m using Base.html. In an earlier tutorial I had an index page which had a view and could call functions from there. But base doesn’t need that so I’m starting to get a little lost.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:49:07+00:00Added an answer on May 31, 2026 at 8:49 am

    haven’t looked up if boto api changed, but this is how it worked last time i looked

    from boto.s3.connection import S3Connection
    from boto.s3.key import Key
    import s3config
    
    conn    = S3Connection(s3config.passwd, s3config.secret)
    bucket  = conn.get_bucket(s3config.bucket)
    s3_path = '/some/path/in/your/bucket'
    keys    = bucket.list(s3_path)
    # or if you want all keys:
    # keys   = bucket.get_all_keys()
    
    for key in keys:
      print key
      # here you can download or do other stuff
      # with the keys like get some metadata
      print key.name
      print key.etag
      print key.size
      print key.last_modified
    

    #s3config.py
    passwd = 'BLABALBALABALA'
    secret = 'xvdwv3efefefefefef'
    bucket = 'name-of-your-bucket'
    

    Update:

    Amazon s3 is a key value store, where key is a string. So nothing prevents you from putting in keys like:

    /this/string/key/looks/like/a/unix/path
    /folder/images/fileA.jpg
    /folder/images/fileB.jpg
    /folder/images/folderX/fileX1.jpg
    

    now bucket.list(prefix="/folder/images/") would yield the latter three.
    Look here for further details:

    • http://readthedocs.org/docs/boto/en/latest/ref/s3.html#boto-s3-bucket
    • http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGET.html?r=8270
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.