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 8816947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:44:10+00:00 2026-06-14T04:44:10+00:00

In a view, I am generating a file, saving it as a field in

  • 0

In a view, I am generating a file, saving it as a field in a Django model (an file field) and returning the url:

...
obj.pdf.save(obj.hash_id + '.pdf', File(open(destination_path, 'r')))

ret = {
  'pdfUrl': obj.pdf.url
}

ret = json.dumps(ret)
return HttpResponse(ret, mimetype='text/plain')

The user is then redirected to the url that is returned in ret, which sometimes is a blank pdf, but if they refresh a second later, the full pdf is there. I suspect S3 is not finished saving it down on their end. Is there any clean way in Django to make sure the file is accessible before returning the url?

  • 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-06-14T04:44:11+00:00Added an answer on June 14, 2026 at 4:44 am

    According to several people in the boto IRC channel, because S3 is distributed, there is no way to tell if the file you’ve uploaded has propagated. But it will happen pretty quickly. Hope this helps anyone else with this issue; you just have to wait a bit. This may change in the future though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django view generating a bunch of data which I want to
I have a requirement to download a PDF file and saving it on clicking
Rails 2, PDFkit 0.5.0 Im generating a PDF from a View in Rails 2
I am generating tar.gz files with Django and save it to somewhere like /home/foo/foo.tar.gz
I have an MVC application view that is generating quite a large HTML table
I need to serve static swf using express framework generating dynamic view similar to:
I have a view helper that manages generating thumbnails for images. The images are
I have HTML view using 2010 .NET, which I am generating in the report
View History on an file in a branch show only changes since the branch.
View Looks Like This <?=form_open_multipart('upload/process');?> <input type=file multiple=multiple name=userfile[] id=userfile /> <?=form_submit('upload', 'Upload');?> <?=form_close();?>

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.