2

I am really stuck with serving dynamically created content in Flask.

If I understand everything right, the only way to do it in Python code is to use Flask native send_file(). Is there a way to perform send_file not through Flask itself? It's extremely slow, I can't afford it :(

I know how to serve statics via nginx, but it seems to be not suitable in my case, cause it links a web address with the real path on my server. When I perform send_file(), the file does not have any web address (am I right?).

So, what should I do?

Paulin
  • 55
  • 1
  • 6
  • I had simular difficulties and I solved my issue and documented it http://stackoverflow.com/a/27221427/567606 – tourdownunder Jul 11 '15 at 06:35
  • When writing the post, I meant other difficulty cause everything was, at least, working in some way. But now I really have trouble with Upstart. You are from FBI, aren't you? – Paulin Jul 11 '15 at 11:20
  • steps 1 and 2 were required for upstart as using the default user was a problem. It was a step I missed out thinking it was unnecessary, though once I did nginx uwsgi and upstart started to work. Not from fbi I'm an ex .NET dev that had a lot of trouble making the switch! To be fair I had lots of trouble debugging IIS back in the day too. At least this way its all scriptable and repeatable with linux once you get it right. – tourdownunder Jul 12 '15 at 02:05

1 Answers1

2

Go read about X-Accel-Redirect response header and how that can be used in conjunction with a nginx front end to have nginx serve up a file which has been written to the file system by a backend web application.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134