WebFaction
Community site: login faq

Here's a partial of a view that processes an uploaded json file.

def add_tag_data(f):

with open(settings.JSON_UPLOAD_DIRECTORY + f.name, 'wb+') as destination:
    for chunk in f.chunks():
        destination.write(chunk)

with open(settings.JSON_UPLOAD_DIRECTORY + f.name) as json_data:
    album_db = json.load(json_data)

I just mimicked the behavior I used for testing on my own machine and wrote the file to a directory I specified in settings.

On WebFaction Nginx comes in to play. I'm getting an error from the Django process:

[Errno 2] No such file or directory: '/home/danjewett/webapps/findcoltrane/tmp/O.json' as if the file is not being written to disk, and I'm getting a warning from Nginx:

2017/12/06 22:08:30 [warn] 35884#0: *45632687 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000007895, client: 67.85.216.93,...

I'm not sure if buffering is the issue, or whether I'm just coding it incorrectly. The process fails with files of any size. The smallest I tried was @100KB

My code is trying to write the file to one location while Nginx has another idea?.

asked 06 Dec, 22:41

danjewett's gravatar image

danjewett
261
accept rate: 100%

closed 07 Dec, 00:53

seanf's gravatar image

seanf ♦♦
12.0k21534

The question has been closed for the following reason "The question is answered, right answer was accepted" by seanf 07 Dec, 00:53


Please pardon me. Script is working. I had an error in my JSON_UPLOAD_DIRECTORY path for the server settings.

permanent link

answered 07 Dec, 00:34

danjewett's gravatar image

danjewett
261
accept rate: 100%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×893
×184
×1

question asked: 06 Dec, 22:41

question was seen: 35 times

last updated: 07 Dec, 00:53

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2017 PARAGON INTERNET GROUP LIMITED
WEBFACTION IS A SERVICE OF PARAGON INTERNET GROUP LIMITED
REGISTERED IN ENGLAND AND WALES 7573953 - VAT REGISTRATION NUMBER 182147021
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM