0

I need to have Django model with a filefield, I want allow max file size of 50MB, after searching a bit I came across this acceptable answer

I know, the question can be termed duplicate. But, the thing is when I tried this piece of code locally it worked fine, but when I used it on my staging servers I started getting 413 error saying Request entity too large. It's a bit strange for a piece of code to behave so different.

Community
  • 1
  • 1
Rajesh Yogeshwar
  • 2,111
  • 2
  • 18
  • 37
  • 1
    That only means that your staging/production servers are configured differently from your dev server. To be precise, they have "max request size" setting set to something lower than the size of file/text you're uploading. So you'd need to change that setting, and it is not related to Django at all. ANd likely it is better suited to serverfault than stackoverflow. Anyway, what web server (apache, nginx, IIS) your staging server uses? – J0HN Apr 29 '16 at 10:22
  • @J0HN its nginx, and you were spot on, I didn't consider it could have been nginx. I think I just jumped the gun :D – Rajesh Yogeshwar Apr 29 '16 at 10:25

1 Answers1

0

Well to answer my own question, in conjuction with introducing a custom file field to allow it have max file size of your choice, respective changes must also be made in webserver to allow larger requests.

Rajesh Yogeshwar
  • 2,111
  • 2
  • 18
  • 37