Re: File Upload with additional Parameters

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer?
 We can help you in this and related tasks at fair prices. Reply or send
email to divy...@pythonmate.com
Best Regards,
Divyesh Khamele,
Pythonmate

On Fri, 9 Oct 2020, 11:20 pm Noel Simela,  wrote:

> Hi guys,
>
> Any suggestions on the best approach to achieve the below with Django's
> upload handlers. I was reviewing documentation at
> https://docs.djangoproject.com/en/3.1/topics/http/file-uploads/
>
> On upload I want to be able to read the contents of the document as per
> below.
>
> Read: –File Name, Author’s Name, Index , count  number pages in the
> document. And populate fields on django template automatically
>
> N.B I am not looking for code, just insight or point me in the right
> direction.
>
> Thank you kindly.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGBhr7Zkukurzvb%3DZ3JmawO3-AZs%3DjtHjEMgWwtCNn0Ln1fEhQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH9mneVGUXZXTm2uu%3Dx_dkErqLnZA-xhdXEERewPrjnmMyySEQ%40mail.gmail.com.


Re: file upload fails with slow network bandwith in django

2016-02-17 Thread Pablo Conesa


El martes, 16 de febrero de 2016, 21:12:32 (UTC+1), James Schneider 
escribió:
>
> How long does the file upload work before receiving the error? 
>

 There is no response from the server (fiddler returns -1, whatever this 
 means) 

>>>
>>> Well, no response from the server doesn't necessarily mean that there 
>>> were no logs. Can you check the error and access logs of the server? 
>>>
>>
>>
>
> Have you checked the server logs?
>

Yesthere are no logs!! I knowjust joined the project and we are 
using the email handlersad! 

>
>  
>
>>  
>>
>>>
>>> Does Fiddler return an immediate response of -1, or does it seem like 
>>> there is a timeout period?
>>>
>>
>> immediate response, no time out period.
>>
>
>
> Without looking at the server logs, I can only guess that Gnuicorn is 
> unhappy with the headers that are being sent, and might be closing the 
> connection. A long timeout would probably indicate that Gnuicorn is waiting 
> for more data but something in the upload process is not triggering that it 
> has reached the end of the data stream.
>

I've done some more test and seems that the -1 is normal while data it's 
been uploaded. Nothing wrong with that. So I guess we need to config the 
logging and start looking at it. 

>
>  
>
>>
>>> After a quick glance at Fiddler itself, are you using any customizations 
>>> on the rules 
>>>
>>
>> no customization. Default "Simulate Modem speeds". I must say I use 
>> fiddle to be able to reproduce the error locally. If I hit the server 
>> (production) using wifi (slower than ethernet) I got the same thing, no 
>> fiddler in the middle.
>>
>
> But it works using a wired Ethernet connection? Honestly, the speed 
> difference between Wi-Fi and Ethernet for this purpose is probably not 
> relevant to the problem. The server logs would tell you more about what is 
> happening.
>  
>

logs, logs, logsI'm on it. :-( 

>
>
>>>
> Nice advice...I'll look into this. Do you know any nice example for 
 that JS library chunk upload.

>
>
>>>
>>> Probably best to stick with your existing JS framework of choice if you 
>>> are using one. All of the major ones have some version of a chunked 
>>> uploader (JQuery and Angular), and I come across resumable.js fairly 
>>> frequently. I've never personally had a need for one, so I can't really 
>>> comment on them in any sort of detail or make a recommendation. 
>>>
>>
>> Testing resumable.jslet's see how it goes. 
>>
>> So, far there is some response, but after a while got 404 response 
>> (testing locally against DAJNGO)will it make a difference against 
>> gunicorn?
>>
>>
>> 
>>
>
> This smells like either a memory exhaustion/ceiling issue or some kind of 
> internal connection/process timeout, neither of which are likely easy to 
> adjust using the Django dev server. Gunicorn probably has 10,000 knobs to 
> adjust those timers and limits, though. 
>
> Look at the server error/access logs.
>

againlogs, logs, logsI'll setup gunicorn locally and enable logging.

For someone wanting to move to a file chunk upload, I've tried resumable.js 
and a django component for it. it was failing. Now I'm happier with this 
other: https://github.com/juliomalegria/django-chunked-upload-demo (test 
over wifi ave worked fine). But again.maybe the problem is in our setup 
and not in those tools.

Thanks, James, you've been vary helpful.

>
> -James
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba2e9f2d-2c6d-4a4a-9259-14a8e95d9135%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: file upload fails with slow network bandwith in django

2016-02-16 Thread James Schneider
>
> How long does the file upload work before receiving the error?

>>>
>>> There is no response from the server (fiddler returns -1, whatever this
>>> means)
>>>
>>
>> Well, no response from the server doesn't necessarily mean that there
>> were no logs. Can you check the error and access logs of the server?
>>
>
>

Have you checked the server logs?



>
>
>>
>> Does Fiddler return an immediate response of -1, or does it seem like
>> there is a timeout period?
>>
>
> immediate response, no time out period.
>


Without looking at the server logs, I can only guess that Gnuicorn is
unhappy with the headers that are being sent, and might be closing the
connection. A long timeout would probably indicate that Gnuicorn is waiting
for more data but something in the upload process is not triggering that it
has reached the end of the data stream.



>
>> After a quick glance at Fiddler itself, are you using any customizations
>> on the rules
>>
>
> no customization. Default "Simulate Modem speeds". I must say I use fiddle
> to be able to reproduce the error locally. If I hit the server (production)
> using wifi (slower than ethernet) I got the same thing, no fiddler in the
> middle.
>

But it works using a wired Ethernet connection? Honestly, the speed
difference between Wi-Fi and Ethernet for this purpose is probably not
relevant to the problem. The server logs would tell you more about what is
happening.



>>
 Nice advice...I'll look into this. Do you know any nice example for
>>> that JS library chunk upload.
>>>


>>
>> Probably best to stick with your existing JS framework of choice if you
>> are using one. All of the major ones have some version of a chunked
>> uploader (JQuery and Angular), and I come across resumable.js fairly
>> frequently. I've never personally had a need for one, so I can't really
>> comment on them in any sort of detail or make a recommendation.
>>
>
> Testing resumable.jslet's see how it goes.
>
> So, far there is some response, but after a while got 404 response
> (testing locally against DAJNGO)will it make a difference against
> gunicorn?
>
>
> 
>

This smells like either a memory exhaustion/ceiling issue or some kind of
internal connection/process timeout, neither of which are likely easy to
adjust using the Django dev server. Gunicorn probably has 10,000 knobs to
adjust those timers and limits, though.

Look at the server error/access logs.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWH3YarsJHniWWv-wzZ4%3D%3DM4Yg7X%2BeBeCKwRRbhQDhG3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: file upload fails with slow network bandwith in django

2016-02-16 Thread Pablo Conesa
Thanks once more James for your help and time. Answers below..

El martes, 16 de febrero de 2016, 8:33:08 (UTC+1), James Schneider escribió:
>
>
>
> On Mon, Feb 15, 2016 at 10:41 PM, Pablo Conesa  > wrote:
>
>> Thanks James. answers in line:
>>
>> El lunes, 15 de febrero de 2016, 23:04:48 (UTC+1), James Schneider 
>> escribió:
>>>
>>>
>>>
>>> On Mon, Feb 15, 2016 at 10:20 AM, Pablo Conesa  
>>> wrote:
>>>
 Hi, I posted this in stackoverflow. Now I'm trying here: 
 http://stackoverflow.com/questions/35413649/file-upload-fails-with-slow-network-bandwith-in-django

 I've got a code working fine that uploads a file to a DJANGO server.

 It works fine on a fine connection.

 Now if, using fiddler to simulate a slow connectionpage freezes 
 (Chrome pop up offering to kill the page).

 I've tested in different ways and the only factor that causes the error 
 is a slow upload speed. e.g. If I choose a wi-fi network it fails but over 
 the ethernet it works.

 File is 100MB!.

 python: 2.7.6 

 DJANGO: 1.5.5 or 1.9 (I updated to 1.9 and is not working either)

 Fiddler show -1 in the response, and says: "No response body".

 Any ideas?


>>>
>>> How long does the file upload work before receiving the error? 
>>>
>>
>> There is no response from the server (fiddler returns -1, whatever this 
>> means) 
>>
>
> Well, no response from the server doesn't necessarily mean that there were 
> no logs. Can you check the error and access logs of the server? 
>

 

>
> Does Fiddler return an immediate response of -1, or does it seem like 
> there is a timeout period?
>

immediate response, no time out period.

>
> After a quick glance at Fiddler itself, are you using any customizations 
> on the rules 
>

no customization. Default "Simulate Modem speeds". I must say I use fiddle 
to be able to reproduce the error locally. If I hit the server (production) 
using wifi (slower than ethernet) I got the same thing, no fiddler in the 
middle.

>
>
>>> My guess is that Fiddler is attempting to use an HTTP chunked transfer 
>>> to send the file 'slowly' (by rate-limiting the chunks it sends rather than 
>>> traffic shaping the data stream itself), which is how modern JS libraries 
>>> normally handle large file uploads. However, this takes advantage of 
>>> features built into the HTTP 1.1 standard, and I'm not entirely sure 
>>> whether or not the Django dev server fully implements HTTP 1.1. That would 
>>> explain why you are getting a response body error (since the Django dev 
>>> server probably doesn't understand chunked requests and doesn't know to 
>>> expect more data). See https://code.djangoproject.com/ticket/25619 
>>> 
>>>  
>>> That's purely a guess though, as I'm not familiar with how Fiddler works, 
>>> and Django's internal support for HTTP 1.1 is somewhat ambiguous. 
>>>
>>
>> Don't know either details about FIddler..but what you are saying sounds 
>> reasonable and in the right direction...
>>
>>>
>>> This type of testing should be done against the production server (which 
>>> likely fully implements HTTP 1.1), not the Django dev server, since 
>>> performance of the dev server cannot be correlated with a production server 
>>> that implements threading and/or multiple worker processes.
>>>
>>
>> I've done this. Actually the bug was reported in production (apache 
>> forwarding to guinicorn)
>>
>
> Hmm, Apache should handle that fine. It's had 1.1 support forever, and I 
> don't believe it requires any special configuration. Might be related to 
> gunicorn, though, if it is responsible for handling the chunked response. 
> Found this to be similar to your issue: 
> https://github.com/benoitc/gunicorn/issues/1125, although sadly no 
> resolution. Might point you in the right direction, though.
>
>
Looks like the same problem ... 

>  
>
>>  
>>
>>>
>>> On a side note, though. If you plan to have users regularly upload large 
>>> files (>2MB), you should seriously look in to implementing chunked uploads 
>>> via a JS library. With a standard upload via a regular form, the worker 
>>> process in your server handling the upload are dedicated to that upload 
>>> until it finishes. Usually this is fine for small uploads, but for larger 
>>> uploads that can take minutes or hours, it becomes a large problem even on 
>>> a site with a small user base. If 5 users are uploading a large file, and 
>>> you only have 5 worker processes running, then literally nobody can access 
>>> your site until at least one of those uploads finishes. With chunked 
>>> transfers, the file is broken up into pieces and sent as many small 
>>> requests rather than a single large one. This allows a server worker 
>>> process to process the small upload, then step away to serve other users, 
>>> and then process t

Re: file upload fails with slow network bandwith in django

2016-02-15 Thread James Schneider
On Mon, Feb 15, 2016 at 10:41 PM, Pablo Conesa 
wrote:

> Thanks James. answers in line:
>
> El lunes, 15 de febrero de 2016, 23:04:48 (UTC+1), James Schneider
> escribió:
>>
>>
>>
>> On Mon, Feb 15, 2016 at 10:20 AM, Pablo Conesa 
>> wrote:
>>
>>> Hi, I posted this in stackoverflow. Now I'm trying here:
>>> http://stackoverflow.com/questions/35413649/file-upload-fails-with-slow-network-bandwith-in-django
>>>
>>> I've got a code working fine that uploads a file to a DJANGO server.
>>>
>>> It works fine on a fine connection.
>>>
>>> Now if, using fiddler to simulate a slow connectionpage freezes
>>> (Chrome pop up offering to kill the page).
>>>
>>> I've tested in different ways and the only factor that causes the error
>>> is a slow upload speed. e.g. If I choose a wi-fi network it fails but over
>>> the ethernet it works.
>>>
>>> File is 100MB!.
>>>
>>> python: 2.7.6
>>>
>>> DJANGO: 1.5.5 or 1.9 (I updated to 1.9 and is not working either)
>>>
>>> Fiddler show -1 in the response, and says: "No response body".
>>>
>>> Any ideas?
>>>
>>>
>>
>> How long does the file upload work before receiving the error?
>>
>
> There is no response from the server (fiddler returns -1, whatever this
> means)
>

Well, no response from the server doesn't necessarily mean that there were
no logs. Can you check the error and access logs of the server?

Does Fiddler return an immediate response of -1, or does it seem like there
is a timeout period?

After a quick glance at Fiddler itself, are you using any customizations on
the rules


>> My guess is that Fiddler is attempting to use an HTTP chunked transfer to
>> send the file 'slowly' (by rate-limiting the chunks it sends rather than
>> traffic shaping the data stream itself), which is how modern JS libraries
>> normally handle large file uploads. However, this takes advantage of
>> features built into the HTTP 1.1 standard, and I'm not entirely sure
>> whether or not the Django dev server fully implements HTTP 1.1. That would
>> explain why you are getting a response body error (since the Django dev
>> server probably doesn't understand chunked requests and doesn't know to
>> expect more data). See https://code.djangoproject.com/ticket/25619
>> 
>> That's purely a guess though, as I'm not familiar with how Fiddler works,
>> and Django's internal support for HTTP 1.1 is somewhat ambiguous.
>>
>
> Don't know either details about FIddler..but what you are saying sounds
> reasonable and in the right direction...
>
>>
>> This type of testing should be done against the production server (which
>> likely fully implements HTTP 1.1), not the Django dev server, since
>> performance of the dev server cannot be correlated with a production server
>> that implements threading and/or multiple worker processes.
>>
>
> I've done this. Actually the bug was reported in production (apache
> forwarding to guinicorn)
>

Hmm, Apache should handle that fine. It's had 1.1 support forever, and I
don't believe it requires any special configuration. Might be related to
gunicorn, though, if it is responsible for handling the chunked response.
Found this to be similar to your issue:
https://github.com/benoitc/gunicorn/issues/1125, although sadly no
resolution. Might point you in the right direction, though.



>
>
>>
>> On a side note, though. If you plan to have users regularly upload large
>> files (>2MB), you should seriously look in to implementing chunked uploads
>> via a JS library. With a standard upload via a regular form, the worker
>> process in your server handling the upload are dedicated to that upload
>> until it finishes. Usually this is fine for small uploads, but for larger
>> uploads that can take minutes or hours, it becomes a large problem even on
>> a site with a small user base. If 5 users are uploading a large file, and
>> you only have 5 worker processes running, then literally nobody can access
>> your site until at least one of those uploads finishes. With chunked
>> transfers, the file is broken up into pieces and sent as many small
>> requests rather than a single large one. This allows a server worker
>> process to process the small upload, then step away to serve other users,
>> and then process the next small upload. The net result on a busy server is
>> usually a slower response, but at least there is a response.
>>
>
> Nice advice...I'll look into this. Do you know any nice example for that
> JS library chunk upload.
>
>>
>>

Probably best to stick with your existing JS framework of choice if you are
using one. All of the major ones have some version of a chunked uploader
(JQuery and Angular), and I come across resumable.js fairly frequently.
I've never personally had a need for one, so I can't really comment on them
in any sort of detail or make a recommendation.

-James

-- 
You received this message because you are subscribed to the

Re: file upload fails with slow network bandwith in django

2016-02-15 Thread Pablo Conesa
Thanks James. answers in line:

El lunes, 15 de febrero de 2016, 23:04:48 (UTC+1), James Schneider escribió:
>
>
>
> On Mon, Feb 15, 2016 at 10:20 AM, Pablo Conesa  > wrote:
>
>> Hi, I posted this in stackoverflow. Now I'm trying here: 
>> http://stackoverflow.com/questions/35413649/file-upload-fails-with-slow-network-bandwith-in-django
>>
>> I've got a code working fine that uploads a file to a DJANGO server.
>>
>> It works fine on a fine connection.
>>
>> Now if, using fiddler to simulate a slow connectionpage freezes 
>> (Chrome pop up offering to kill the page).
>>
>> I've tested in different ways and the only factor that causes the error 
>> is a slow upload speed. e.g. If I choose a wi-fi network it fails but over 
>> the ethernet it works.
>>
>> File is 100MB!.
>>
>> python: 2.7.6 
>>
>> DJANGO: 1.5.5 or 1.9 (I updated to 1.9 and is not working either)
>>
>> Fiddler show -1 in the response, and says: "No response body".
>>
>> Any ideas?
>>
>>
>
> How long does the file upload work before receiving the error? 
>

There is no response from the server (fiddler returns -1, whatever this 
means) 

>
> My guess is that Fiddler is attempting to use an HTTP chunked transfer to 
> send the file 'slowly' (by rate-limiting the chunks it sends rather than 
> traffic shaping the data stream itself), which is how modern JS libraries 
> normally handle large file uploads. However, this takes advantage of 
> features built into the HTTP 1.1 standard, and I'm not entirely sure 
> whether or not the Django dev server fully implements HTTP 1.1. That would 
> explain why you are getting a response body error (since the Django dev 
> server probably doesn't understand chunked requests and doesn't know to 
> expect more data). See https://code.djangoproject.com/ticket/25619 
> 
>  
> That's purely a guess though, as I'm not familiar with how Fiddler works, 
> and Django's internal support for HTTP 1.1 is somewhat ambiguous. 
>

Don't know either details about FIddler..but what you are saying sounds 
reasonable and in the right direction...

>
> This type of testing should be done against the production server (which 
> likely fully implements HTTP 1.1), not the Django dev server, since 
> performance of the dev server cannot be correlated with a production server 
> that implements threading and/or multiple worker processes.
>

I've done this. Actually the bug was reported in production (apache 
forwarding to guinicorn)
 

>
> On a side note, though. If you plan to have users regularly upload large 
> files (>2MB), you should seriously look in to implementing chunked uploads 
> via a JS library. With a standard upload via a regular form, the worker 
> process in your server handling the upload are dedicated to that upload 
> until it finishes. Usually this is fine for small uploads, but for larger 
> uploads that can take minutes or hours, it becomes a large problem even on 
> a site with a small user base. If 5 users are uploading a large file, and 
> you only have 5 worker processes running, then literally nobody can access 
> your site until at least one of those uploads finishes. With chunked 
> transfers, the file is broken up into pieces and sent as many small 
> requests rather than a single large one. This allows a server worker 
> process to process the small upload, then step away to serve other users, 
> and then process the next small upload. The net result on a busy server is 
> usually a slower response, but at least there is a response.
>

Nice advice...I'll look into this. Do you know any nice example for that JS 
library chunk upload.

>
> -James
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d400904-8fe8-460c-b9cd-e8ba6521a96a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: file upload fails with slow network bandwith in django

2016-02-15 Thread Pablo Conesa
Thanks Ezequiel, answer below.

El lunes, 15 de febrero de 2016, 21:22:23 (UTC+1), Ezequiel Bertti escribió:
>
> You are using de runserver to develop and getting this error or something 
> like gunicorn and nginx?
>

In production  we are using gunicorn, locally I don't use guinicorn, and in 
both cases it happens the same.

Unfortunately there is no message, no time out, nothing from the server.

>
> Because the nginx have some time to proccess each request.
>
> http://stackoverflow.com/questions/6816215/gunicorn-nginx-timeout-problem 
> 
>
> On Mon, Feb 15, 2016 at 4:20 PM, Pablo Conesa  > wrote:
>
>> Hi, I posted this in stackoverflow. Now I'm trying here: 
>> http://stackoverflow.com/questions/35413649/file-upload-fails-with-slow-network-bandwith-in-django
>>
>> I've got a code working fine that uploads a file to a DJANGO server.
>>
>> It works fine on a fine connection.
>>
>> Now if, using fiddler to simulate a slow connectionpage freezes 
>> (Chrome pop up offering to kill the page).
>>
>> I've tested in different ways and the only factor that causes the error 
>> is a slow upload speed. e.g. If I choose a wi-fi network it fails but over 
>> the ethernet it works.
>>
>> File is 100MB!.
>>
>> python: 2.7.6 
>>
>> DJANGO: 1.5.5 or 1.9 (I updated to 1.9 and is not working either)
>>
>> Fiddler show -1 in the response, and says: "No response body".
>>
>> Any ideas?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/3625feed-bc42-4d80-a8cb-d6a8c94a48cf%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Ezequiel Bertti
> E-Mail: ebe...@gmail.com 
> Cel: (21) 99188-4860
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0307bb9e-01dd-4f52-a004-b0f7277b9354%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: file upload fails with slow network bandwith in django

2016-02-15 Thread James Schneider
On Mon, Feb 15, 2016 at 10:20 AM, Pablo Conesa 
wrote:

> Hi, I posted this in stackoverflow. Now I'm trying here:
> http://stackoverflow.com/questions/35413649/file-upload-fails-with-slow-network-bandwith-in-django
>
> I've got a code working fine that uploads a file to a DJANGO server.
>
> It works fine on a fine connection.
>
> Now if, using fiddler to simulate a slow connectionpage freezes
> (Chrome pop up offering to kill the page).
>
> I've tested in different ways and the only factor that causes the error is
> a slow upload speed. e.g. If I choose a wi-fi network it fails but over the
> ethernet it works.
>
> File is 100MB!.
>
> python: 2.7.6
>
> DJANGO: 1.5.5 or 1.9 (I updated to 1.9 and is not working either)
>
> Fiddler show -1 in the response, and says: "No response body".
>
> Any ideas?
>
>

How long does the file upload work before receiving the error?

My guess is that Fiddler is attempting to use an HTTP chunked transfer to
send the file 'slowly' (by rate-limiting the chunks it sends rather than
traffic shaping the data stream itself), which is how modern JS libraries
normally handle large file uploads. However, this takes advantage of
features built into the HTTP 1.1 standard, and I'm not entirely sure
whether or not the Django dev server fully implements HTTP 1.1. That would
explain why you are getting a response body error (since the Django dev
server probably doesn't understand chunked requests and doesn't know to
expect more data). See https://code.djangoproject.com/ticket/25619 That's
purely a guess though, as I'm not familiar with how Fiddler works, and
Django's internal support for HTTP 1.1 is somewhat ambiguous.

This type of testing should be done against the production server (which
likely fully implements HTTP 1.1), not the Django dev server, since
performance of the dev server cannot be correlated with a production server
that implements threading and/or multiple worker processes.

On a side note, though. If you plan to have users regularly upload large
files (>2MB), you should seriously look in to implementing chunked uploads
via a JS library. With a standard upload via a regular form, the worker
process in your server handling the upload are dedicated to that upload
until it finishes. Usually this is fine for small uploads, but for larger
uploads that can take minutes or hours, it becomes a large problem even on
a site with a small user base. If 5 users are uploading a large file, and
you only have 5 worker processes running, then literally nobody can access
your site until at least one of those uploads finishes. With chunked
transfers, the file is broken up into pieces and sent as many small
requests rather than a single large one. This allows a server worker
process to process the small upload, then step away to serve other users,
and then process the next small upload. The net result on a busy server is
usually a slower response, but at least there is a response.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVkP4PWcnteD36qV8R5KB2t%2BmEgO00ONbiEXPNT%2B_7yKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: file upload fails with slow network bandwith in django

2016-02-15 Thread Ezequiel Bertti
You are using de runserver to develop and getting this error or something
like gunicorn and nginx?

Because the nginx have some time to proccess each request.

http://stackoverflow.com/questions/6816215/gunicorn-nginx-timeout-problem

On Mon, Feb 15, 2016 at 4:20 PM, Pablo Conesa 
wrote:

> Hi, I posted this in stackoverflow. Now I'm trying here:
> http://stackoverflow.com/questions/35413649/file-upload-fails-with-slow-network-bandwith-in-django
>
> I've got a code working fine that uploads a file to a DJANGO server.
>
> It works fine on a fine connection.
>
> Now if, using fiddler to simulate a slow connectionpage freezes
> (Chrome pop up offering to kill the page).
>
> I've tested in different ways and the only factor that causes the error is
> a slow upload speed. e.g. If I choose a wi-fi network it fails but over the
> ethernet it works.
>
> File is 100MB!.
>
> python: 2.7.6
>
> DJANGO: 1.5.5 or 1.9 (I updated to 1.9 and is not working either)
>
> Fiddler show -1 in the response, and says: "No response body".
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3625feed-bc42-4d80-a8cb-d6a8c94a48cf%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Ezequiel Bertti
E-Mail: eber...@gmail.com
Cel: (21) 99188-4860

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACrQMYpb6pcEmObzZBL%3Dm05sCTtfp2ezcpG51TROdGueFmROeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: File Upload in Django

2015-05-16 Thread Timothy W. Cook
The official docs are a good place to start
https://docs.djangoproject.com/en/1.8/topics/http/file-uploads/

This GitHub example is about the newest one available showing the changes
in recent Django versions
https://github.com/axelpale/minimal-django-file-upload-example



On Sat, May 16, 2015 at 5:33 AM, SUBHABRATA BANERJEE <
subhabrata.bane...@gmail.com> wrote:

> Dear Group,
>
> I want to upload file and form in Django. I am using Django 1.8 on Windows
> 2.7+ on Windows 7 Professional.
> I am bit new and I was confused how may I upload file and form in Django.
> If anyone may kindly show me an example tutorial. I tried some examples on
> Github and stackoverflow but not
> of much help.
>
> Regards,
> Subhabrata Banerjee.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e94e0724-f243-43d2-834f-f7a41652fcac%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 


Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3Uz0mmibDtEvkhApx1XjmF_yWVNV_EoAFaSUe4JWwEodA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: File Upload, Download and Search Files

2015-03-04 Thread Vijay Khemlani
You can save files as part of models, for example using FileFields

https://docs.djangoproject.com/en/1.7/ref/models/fields/#filefield

Or you can handle them manually, for example using default_storage

https://docs.djangoproject.com/en/1.7/topics/files/

Regarding File Search, I don't know, never had to do that before.

On Mon, Mar 2, 2015 at 4:10 PM, New@Django  wrote:

> Hi!
>
> I am just starting to use Django. I would like to know if anyone could
> point me in the direction for having the following capability:
>
> - File Storage System (Upload, Download, Delete)
>
> - File Search
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/184fa1dc-b6d3-4b17-8f4e-dace66240c7f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1R4g5-nMr2cF98DYfJJrZdwtOs7yKDU1G1tSeBcshZmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: File upload error

2015-02-25 Thread Amirouche Boubekki
Héllo again (at last)

On Mon, Feb 16, 2015 at 11:20 AM Sola Chong  wrote:

> I having a error "*expected string or buffer*" when submit to upload
> avatar when edit profile. Can't figure out what is the problem..
>



I've setup a small project with your code (and small modifications) using
django 1.7 and python 2.7.8 (it's important to provide that infos).

I did not reproduce the error.

I describe below what I changed or can be changed:



>
> *Model:*
> class MyProfile(models.Model):
> user = models.ForeignKey(User)
> dob = models.DateField(null=True, blank=True)
> address = models.CharField(max_length=100, blank=True)
> contact = models.CharField(max_length=50, blank=True)
> bio = models.TextField(blank=True)
> avatar_url = FileField(_("Avatar"), max_length=200, format="Image",
>  upload_to='user/avatar', blank=True)
> banner_url = FileField(_("Cover"), max_length=200, format="Image",
>  upload_to='user/cover', blank=True)
> created = models.DateTimeField(auto_now_add=True)
> last_modified = models.DateTimeField(auto_now=True)
>

- There is no "format" parameter in FileField constructor.
- it's better to stay consistent regarding the model fields and use
models.FileField instead of FileField alone. If FileField is a custom
class, it should have another name.
- User model is referenced directly. You can live with that. It can break
in some situations cf.
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#referencing-the-user-model


> *Forms:*
> class UserModelForm(forms.ModelForm):
> class Meta:
> model = User
> fields = ('first_name', 'last_name', 'email')
> widgets = {
> 'email': forms.TextInput(attrs={'readonly':'readonly'}),
> }
>
>
> class UserProfileModelForm(forms.ModelForm):
> dob = forms.DateField(widget=forms.DateInput(format = '%d/%m/%Y'),
>input_formats=('%d/%m/%Y',),
>required=True, help_text='dd/mm/')
> avatar_url = forms.FileField()
>
> class Meta:
> model = MyProfile
> fields = ('dob', 'address', 'contact', 'bio', 'avatar_url')
>
>
> *Views:*
> def editProfileView(request, template="controlpanel/cp_edit_profile.html"
> ):
>
> myprofiles = MyProfile.objects.all()
> myprofile = get_object_or_404(myprofiles, user=request.user)
>
> if request.method == "POST":
> form = UserProfileModelForm(request.POST, request.FILES, instance=
> myprofile)
> userForm = UserModelForm(request.POST, request.FILES, instance=
> request.user)
>
> if form.is_valid() and userForm.is_valid():
> user = userForm.save()
> profile = form.save(commit = False)
> profile.user = user
> profile.save()
>
>
> info(request, _("Successfully Edit"))
> else:
> userForm = UserModelForm(instance=request.user)
> form = UserProfileModelForm(instance=myprofile)
>
>
> context = {"cpprofile": myprofile, 'userForm':userForm, 'form':form}
>
> return render(request, template, context)
>
> *Template:*
> 
> 
> {{ title }}
> {% fields_for userForm %}
> {% fields_for form %}
> 
> {% block account_form_actions %}
>  "submit" value="Submit">
> {% endblock %}
> 
> 
> 
>
>
I don't know {% fields_for %} tag. I used {{ userForm.as_ul }} instead.

If you are interested, I can push the code online.


HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL7_Mo99KPV%2BACtMEcmcUanVTMiY5idkouAsDrmv-UdWVM1M7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: File upload error

2015-02-16 Thread Amirouche Boubekki
Héllo Sola,


Can you post the full stacktrace not only the error?


Regards

On Mon Feb 16 2015 at 11:20:42 AM Sola Chong  wrote:

> I having a error "*expected string or buffer*" when submit to upload
> avatar when edit profile. Can't figure out what is the problem..
>
> *Model:*
> class MyProfile(models.Model):
> user = models.ForeignKey(User)
> dob = models.DateField(null=True, blank=True)
> address = models.CharField(max_length=100, blank=True)
> contact = models.CharField(max_length=50, blank=True)
> bio = models.TextField(blank=True)
> avatar_url = FileField(_("Avatar"), max_length=200, format="Image",
>  upload_to='user/avatar', blank=True)
> banner_url = FileField(_("Cover"), max_length=200, format="Image",
>  upload_to='user/cover', blank=True)
> created = models.DateTimeField(auto_now_add=True)
> last_modified = models.DateTimeField(auto_now=True)
>
> *Forms:*
> class UserModelForm(forms.ModelForm):
> class Meta:
> model = User
> fields = ('first_name', 'last_name', 'email')
> widgets = {
> 'email': forms.TextInput(attrs={'readonly':'readonly'}),
> }
>
>
> class UserProfileModelForm(forms.ModelForm):
> dob = forms.DateField(widget=forms.DateInput(format = '%d/%m/%Y'),
>input_formats=('%d/%m/%Y',),
>required=True, help_text='dd/mm/')
> avatar_url = forms.FileField()
>
> class Meta:
> model = MyProfile
> fields = ('dob', 'address', 'contact', 'bio', 'avatar_url')
>
>
> *Views:*
> def editProfileView(request, template="controlpanel/cp_edit_profile.html"
> ):
>
> myprofiles = MyProfile.objects.all()
> myprofile = get_object_or_404(myprofiles, user=request.user)
>
> if request.method == "POST":
> form = UserProfileModelForm(request.POST, request.FILES, instance=
> myprofile)
> userForm = UserModelForm(request.POST, request.FILES, instance=
> request.user)
>
> if form.is_valid() and userForm.is_valid():
> user = userForm.save()
> profile = form.save(commit = False)
> profile.user = user
> profile.save()
>
>
> info(request, _("Successfully Edit"))
> else:
> userForm = UserModelForm(instance=request.user)
> form = UserProfileModelForm(instance=myprofile)
>
>
> context = {"cpprofile": myprofile, 'userForm':userForm, 'form':form}
>
> return render(request, template, context)
>
> *Template:*
> 
> 
> {{ title }}
> {% fields_for userForm %}
> {% fields_for form %}
> 
> {% block account_form_actions %}
>  "submit" value="Submit">
> {% endblock %}
> 
> 
> 
>
>
> Thank you in advance...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c34f91dc-20a8-4195-ba8d-134287e1f9ae%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL7_Mo8weKby069OsM9s2nUu9Zr61N8%2BLYLO01smCese-s%2Bo7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: File upload limits

2011-06-05 Thread Siddharth S
I'm running apache2 on the server. But as I mentioned, a parallel site based
on PHP is able to take file uploads larger than 1Mb. So, I guess it isn't an
apache configuration problem.

On Sun, Jun 5, 2011 at 9:38 PM, ionic drive  wrote:

> This i guess is not a django setting.
> Its a setting of your webserver (Nginx, Apache2, etc.)
>
> If you do use Nginx as an example, this setting would be
> client_max_body_size.
>
> http://www.rockia.com/2011/01/how-to-change-nginx-file-upload-size-limit
>
> good luck
> scrapper
>
>
>
> On Sun, 2011-06-05 at 06:57 -0700, Siddharth Swaminathan wrote:
> > Hi,
> >
> >
> > I have a django project where I have a form to upload files. The
> > problem is that I'm not able to upload files larger than 192Kb.
> > Is there some django setting that can be used to change this
> > behaviour?
> >
> >
> > Also, I've eliminated the possibility of apache configuration
> > problems, coz a parallel drupal site on the same server is able to
> > accept files larger than even 1Mb.
> >
> >
> > Any help would be appreciated.
> >
> >
> > Thanks in advance,
> > Siddharth Swaminathan
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/VjJXMVhZeWE2WHNK.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to django-users
> > +unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Siddharth. S,
Dept. of Mechanical Engineering,
Indian Institute of Technology, Madras.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload limits

2011-06-05 Thread ionic drive
This i guess is not a django setting.
Its a setting of your webserver (Nginx, Apache2, etc.)

If you do use Nginx as an example, this setting would be
client_max_body_size.

http://www.rockia.com/2011/01/how-to-change-nginx-file-upload-size-limit

good luck
scrapper



On Sun, 2011-06-05 at 06:57 -0700, Siddharth Swaminathan wrote:
> Hi, 
> 
> 
> I have a django project where I have a form to upload files. The
> problem is that I'm not able to upload files larger than 192Kb.
> Is there some django setting that can be used to change this
> behaviour?
> 
> 
> Also, I've eliminated the possibility of apache configuration
> problems, coz a parallel drupal site on the same server is able to
> accept files larger than even 1Mb.
> 
> 
> Any help would be appreciated.
> 
> 
> Thanks in advance,
> Siddharth Swaminathan
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/VjJXMVhZeWE2WHNK.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users
> +unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload fails

2011-03-17 Thread Matias Aguirre
You are missing the enctype form attribute needed for files input fields. Your
form definition should be:



Check http://www.w3.org/TR/html401/interact/forms.html#adef-enctype for details.

Matías


Excerpts from arapaho's message of Thu Mar 17 15:53:45 -0300 2011:
> Hi,
> 
> Rather new to Django and using 1.2.5 and Windows, I am hung up trying
> to upload a file. I get a post request with request.FILES empty.
> 
> My VIEW is:
> 
> def intro(request):
> c = {}
> c.update(csrf(request))
> 
> if request.method == 'POST': #see if form submitted
> 
> form = FileUploadForm(request.POST,request.FILES)
> print request.FILES
> if form.is_valid():
> text = 'You successfully uploaded file:'
> handle_uploaded_file(request.FILES['file'])
> else:
> text = 'You may upload your student data file here'
> form = FileUploadForm()
> 
> c['form'] = form
> c['text'] = text
> return render_to_response('intro.html', c)
> 
> 
> In SETTINGS I have:
> 
> ROOT_PATH = os.path.dirname(__file__)
> 
> MEDIA_ROOT = '/media/'
> 
> MEDIA_URL = '/media/'
> 
> And my TEMPLATE includes:
> 
> {% csrf_token %}
> 
> 
> {{ form }}
> 
> 
> 
> Any suggestions much appreciated.
> 
> Bob
> 
-- 
Matías Aguirre 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-17 Thread vamsy krishna
Yes Tom, thanks. That makes sense. And yes it works like a charm on
Opera.

On Mar 17, 2:47 pm, Tom Evans  wrote:
> On Thu, Mar 17, 2011 at 6:51 AM, vamsy krishna  wrote:
> > That is true Michal. My understanding is that the server does send
> > back a 413 response as soon as it finds the huge mismatch in the
> > upload limit and the actual upload size. Also I think the server
> > immediately terminates the connection for the request. The problem
> > however is that the browser instead of reading the response from the
> > server shows the connection interrupted message. Ideally I would like
> > to configure it in a way the 413 error page is shown instead. Or do
> > you think it is not feasible in such a case?
>
> > Regards,
> > Vamsy
>
> Think for a moment about how this works. You've set the upload limit
> to 500k. If you start uploading more than this, then the web server
> can really only do one thing, it can send you a 413 response and close
> the connection.
>
> If your browser then tries to continue to upload the file, it will try
> to write data to a closed socket connection, and fail. If it's smart,
> it will then see if there is a response to read from the socket,
> otherwise it will display a cryptic 'connection interrupted' message.
> Try the same test in a bunch of browsers; I bet Opera will handle it
> correctly.
>
> You've asked for the connection to be interrupted, by setting
> LimitRequestBody. It can't both limit the request body size, and wait
> for a client to be ready to read the error response.
>
> Cheers
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-17 Thread Tom Evans
On Thu, Mar 17, 2011 at 6:51 AM, vamsy krishna  wrote:
> That is true Michal. My understanding is that the server does send
> back a 413 response as soon as it finds the huge mismatch in the
> upload limit and the actual upload size. Also I think the server
> immediately terminates the connection for the request. The problem
> however is that the browser instead of reading the response from the
> server shows the connection interrupted message. Ideally I would like
> to configure it in a way the 413 error page is shown instead. Or do
> you think it is not feasible in such a case?
>
> Regards,
> Vamsy
>

Think for a moment about how this works. You've set the upload limit
to 500k. If you start uploading more than this, then the web server
can really only do one thing, it can send you a 413 response and close
the connection.

If your browser then tries to continue to upload the file, it will try
to write data to a closed socket connection, and fail. If it's smart,
it will then see if there is a response to read from the socket,
otherwise it will display a cryptic 'connection interrupted' message.
Try the same test in a bunch of browsers; I bet Opera will handle it
correctly.

You've asked for the connection to be interrupted, by setting
LimitRequestBody. It can't both limit the request body size, and wait
for a client to be ready to read the error response.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-16 Thread vamsy krishna
That is true Michal. My understanding is that the server does send
back a 413 response as soon as it finds the huge mismatch in the
upload limit and the actual upload size. Also I think the server
immediately terminates the connection for the request. The problem
however is that the browser instead of reading the response from the
server shows the connection interrupted message. Ideally I would like
to configure it in a way the 413 error page is shown instead. Or do
you think it is not feasible in such a case?

Regards,
Vamsy

On Mar 16, 9:36 pm, Michal Petrucha  wrote:
> > > I've set a custom error page for the 413 error when the upload file
> > > size exceeds the maximum set in apache LimitRequestBody directive (500
> > > KB).
> > > This is working fine for all files upto 3 MB. However when the size
> > > exceeds this limit, the browser is showing the below message instead
> > > of my custom error page. Can someone point me in the right direction?
>
> > > Connection Interrupted
>
> > > The connection to the server was reset while the page was
> > > loading.
>
> > > The network link was interrupted while negotiating a connection.
> > > Please try again.
>
> My guess is that the webserver hangs up as soon as it sees the
> request size exceeds some multiple of the limit.
>
> I think this is reasonable, just imagine that somebody would try to
> upload for example /dev/urandom or /dev/zero (i. e. an infinite amount
> of data). Would you want the server to suck it all in and then give an
> error message saying that the limit has been exceeded?
>
> Michal Petrucha
>
>  signature.asc
> < 1KViewDownload

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-16 Thread Michal Petrucha
> > I've set a custom error page for the 413 error when the upload file
> > size exceeds the maximum set in apache LimitRequestBody directive (500
> > KB).
> > This is working fine for all files upto 3 MB. However when the size
> > exceeds this limit, the browser is showing the below message instead
> > of my custom error page. Can someone point me in the right direction?
> >
> > Connection Interrupted
> >
> > The connection to the server was reset while the page was
> > loading.
> >
> > The network link was interrupted while negotiating a connection.
> > Please try again.
My guess is that the webserver hangs up as soon as it sees the
request size exceeds some multiple of the limit.

I think this is reasonable, just imagine that somebody would try to
upload for example /dev/urandom or /dev/zero (i. e. an infinite amount
of data). Would you want the server to suck it all in and then give an
error message saying that the limit has been exceeded?

Michal Petrucha


signature.asc
Description: Digital signature


Re: file upload size problem

2011-03-15 Thread vamsy krishna
Any suggestions please?

On Mar 15, 12:18 pm, vamsy krishna  wrote:
> Hi All,
>
> I've set a custom error page for the 413 error when the upload file
> size exceeds the maximum set in apache LimitRequestBody directive (500
> KB).
> This is working fine for all files upto 3 MB. However when the size
> exceeds this limit, the browser is showing the below message instead
> of my custom error page. Can someone point me in the right direction?
>
> Connection Interrupted
>
> The connection to the server was reset while the page was
> loading.
>
> The network link was interrupted while negotiating a connection.
> Please try again.
>
> Thanks,
> Vamsy
>
> On Mar 15, 11:21 am, vamsy krishna  wrote:
>
> > Thanks Tom. I also looked up the Django code and realised there is no
> > handler413 defined. I'm now doing it in apache the way you mentioned.
>
> > On Mar 14, 4:38 pm, Tom Evans  wrote:
>
> > > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna  
> > > wrote:
> > > > I'm facing a new problem now. I have a defined a custom error page and
> > > > using the handler413 in my urls file to load this template. However
> > > > this is not getting picked up. I would like to handle this at django
> > > > level instead of apache. The ErrorDocument definition in apache works
> > > > fine.
>
> > > > Also the handler404 and handler500 are working without any issue. Can
> > > > someone point me in the right direction?
>
> > > > Thanks,
> > > > Vamsy
>
> > > handler404 and handler500 get called if django tries to serve a page
> > > that doesn't exist or a page that errors. Your 413 is generated from
> > > apache, and so does not ever call django, therefore django cannot
> > > handle this error.
>
> > > To get around this, set
>
> > > ErrorHandler 413 /some/django/url
>
> > > Apache will use an internal redirect to fetch this URL, so it should
> > > be transparent to your users.
>
> > > Cheers
>
> > > Tom
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-15 Thread vamsy krishna
Hi All,

I've set a custom error page for the 413 error when the upload file
size exceeds the maximum set in apache LimitRequestBody directive (500
KB).
This is working fine for all files upto 3 MB. However when the size
exceeds this limit, the browser is showing the below message instead
of my custom error page. Can someone point me in the right direction?

Connection Interrupted

The connection to the server was reset while the page was
loading.

The network link was interrupted while negotiating a connection.
Please try again.


Thanks,
Vamsy

On Mar 15, 11:21 am, vamsy krishna  wrote:
> Thanks Tom. I also looked up the Django code and realised there is no
> handler413 defined. I'm now doing it in apache the way you mentioned.
>
> On Mar 14, 4:38 pm, Tom Evans  wrote:
>
> > On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna  
> > wrote:
> > > I'm facing a new problem now. I have a defined a custom error page and
> > > using the handler413 in my urls file to load this template. However
> > > this is not getting picked up. I would like to handle this at django
> > > level instead of apache. The ErrorDocument definition in apache works
> > > fine.
>
> > > Also the handler404 and handler500 are working without any issue. Can
> > > someone point me in the right direction?
>
> > > Thanks,
> > > Vamsy
>
> > handler404 and handler500 get called if django tries to serve a page
> > that doesn't exist or a page that errors. Your 413 is generated from
> > apache, and so does not ever call django, therefore django cannot
> > handle this error.
>
> > To get around this, set
>
> > ErrorHandler 413 /some/django/url
>
> > Apache will use an internal redirect to fetch this URL, so it should
> > be transparent to your users.
>
> > Cheers
>
> > Tom
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-14 Thread vamsy krishna
Thanks Tom. I also looked up the Django code and realised there is no
handler413 defined. I'm now doing it in apache the way you mentioned.

On Mar 14, 4:38 pm, Tom Evans  wrote:
> On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna  wrote:
> > I'm facing a new problem now. I have a defined a custom error page and
> > using the handler413 in my urls file to load this template. However
> > this is not getting picked up. I would like to handle this at django
> > level instead of apache. The ErrorDocument definition in apache works
> > fine.
>
> > Also the handler404 and handler500 are working without any issue. Can
> > someone point me in the right direction?
>
> > Thanks,
> > Vamsy
>
> handler404 and handler500 get called if django tries to serve a page
> that doesn't exist or a page that errors. Your 413 is generated from
> apache, and so does not ever call django, therefore django cannot
> handle this error.
>
> To get around this, set
>
> ErrorHandler 413 /some/django/url
>
> Apache will use an internal redirect to fetch this URL, so it should
> be transparent to your users.
>
> Cheers
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-14 Thread Tom Evans
On Mon, Mar 14, 2011 at 9:02 AM, vamsy krishna  wrote:
> I'm facing a new problem now. I have a defined a custom error page and
> using the handler413 in my urls file to load this template. However
> this is not getting picked up. I would like to handle this at django
> level instead of apache. The ErrorDocument definition in apache works
> fine.
>
> Also the handler404 and handler500 are working without any issue. Can
> someone point me in the right direction?
>
> Thanks,
> Vamsy
>

handler404 and handler500 get called if django tries to serve a page
that doesn't exist or a page that errors. Your 413 is generated from
apache, and so does not ever call django, therefore django cannot
handle this error.

To get around this, set

ErrorHandler 413 /some/django/url

Apache will use an internal redirect to fetch this URL, so it should
be transparent to your users.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-14 Thread vamsy krishna
I'm facing a new problem now. I have a defined a custom error page and
using the handler413 in my urls file to load this template. However
this is not getting picked up. I would like to handle this at django
level instead of apache. The ErrorDocument definition in apache works
fine.

Also the handler404 and handler500 are working without any issue. Can
someone point me in the right direction?

Thanks,
Vamsy

On Mar 14, 11:07 am, vamsy krishna  wrote:
> Oh yes. Thanks Karen.
>
> On Mar 12, 7:06 pm, Karen Tracey  wrote:
>
> > On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna 
> > wrote:
>
> > > I'm doing a file upload from one of my forms and writing the content
> > > to a temp file on the server. The problem is any file of size more
> > > than 250 KB is throwing the below error:
>
> > > Request Entity Too Large
> > > The requested resource
> > > /tera/tera_upload/
> > > does not allow request data with POST requests, or the amount of data
> > > provided in the request exceeds the capacity limit.
>
> > > I read through the django file uploads documentation and it says the
> > > default file upload size in memory is about 2.5 MB. Can anyone tell me
> > > what I'm overlooking? Also how do I set a maximum file size limit and
> > > handle it?
>
> > This error isn't coming from Django, it's coming from your web server which
> > has apparently been configured to limit request body size. How to change the
> > limit will depend on what server you are using. If Apache, see for example
> > LimitRequestBody here:http://httpd.apache.org/docs/2.0/mod/core.html
>
> > Karen
> > --http://tracey.org/kmt/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-13 Thread vamsy krishna
Oh yes. Thanks Karen.

On Mar 12, 7:06 pm, Karen Tracey  wrote:
> On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna wrote:
>
> > I'm doing a file upload from one of my forms and writing the content
> > to a temp file on the server. The problem is any file of size more
> > than 250 KB is throwing the below error:
>
> > Request Entity Too Large
> > The requested resource
> > /tera/tera_upload/
> > does not allow request data with POST requests, or the amount of data
> > provided in the request exceeds the capacity limit.
>
> > I read through the django file uploads documentation and it says the
> > default file upload size in memory is about 2.5 MB. Can anyone tell me
> > what I'm overlooking? Also how do I set a maximum file size limit and
> > handle it?
>
> This error isn't coming from Django, it's coming from your web server which
> has apparently been configured to limit request body size. How to change the
> limit will depend on what server you are using. If Apache, see for example
> LimitRequestBody here:http://httpd.apache.org/docs/2.0/mod/core.html
>
> Karen
> --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload size problem

2011-03-12 Thread Karen Tracey
On Sat, Mar 12, 2011 at 12:06 AM, vamsy krishna wrote:

> I'm doing a file upload from one of my forms and writing the content
> to a temp file on the server. The problem is any file of size more
> than 250 KB is throwing the below error:
>
> Request Entity Too Large
> The requested resource
> /tera/tera_upload/
> does not allow request data with POST requests, or the amount of data
> provided in the request exceeds the capacity limit.
>
> I read through the django file uploads documentation and it says the
> default file upload size in memory is about 2.5 MB. Can anyone tell me
> what I'm overlooking? Also how do I set a maximum file size limit and
> handle it?
>

This error isn't coming from Django, it's coming from your web server which
has apparently been configured to limit request body size. How to change the
limit will depend on what server you are using. If Apache, see for example
LimitRequestBody here: http://httpd.apache.org/docs/2.0/mod/core.html

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread vanderkerkoff
Thanks again Karen


On Feb 6, 6:06 pm, Karen Tracey  wrote:
> On Sun, Feb 6, 2011 at 12:45 PM, vanderkerkoff  wrote:
> > I got it :-)
>
> > import os
> > PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
>
> > # MEDIA_ROOT = (
> > #       os.path.join(PROJECT_PATH, 'static/media/'),
> > # )
>
> > MEDIA_ROOT = '/Users/mjdavies/Sites/django/governors/static/media/'
>
> > statically pointing the media root works
>
> You rather threw out the baby with the bathwater there. The problem with
> your original setting was that you made MEDIA_ROOT a tuple, not a string.
> Just fixing it to be the right type, but still dynamically computed based on
> your project's location, would have been sufficient.
>
> > I use the same method above to grab templates, and that works ok
>
> Note TEMPLATE_DIRS is supposed to be a 
> tuple:http://docs.djangoproject.com/en/1.2/ref/settings/#template-dirs
>
> while MEDIA_ROOT is supposed to be a 
> string:http://docs.djangoproject.com/en/1.2/ref/settings/#media-root
>
> You need to adjust your method when cribbing from one setting to another and
> ensure you give each setting a value of the appropriate type.
>
> Note also this is why I suggested taking a look at (not necessarily posting
> to the list) the values of the local variables on the debug page. The code
> you were focused on (model and model admin defs) was correct, and the
> problem was elsewhere. Seeing the actual value of s that was being used
> (presumably the tuple MEDIA_ROOT had been set to) might have given you a
> clue as to where the problem was.
>
> If you have difficulty understanding all that is presented by the debug page
> and how to make use of it, there is a book linked from the page in my sig
> that may be helpful to you in improving your debugging skills.
>
> Karen
> --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread Karen Tracey
On Sun, Feb 6, 2011 at 12:45 PM, vanderkerkoff  wrote:

> I got it :-)
>
> import os
> PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
>
> # MEDIA_ROOT = (
> #   os.path.join(PROJECT_PATH, 'static/media/'),
> # )
>
> MEDIA_ROOT = '/Users/mjdavies/Sites/django/governors/static/media/'
>
> statically pointing the media root works
>
>
You rather threw out the baby with the bathwater there. The problem with
your original setting was that you made MEDIA_ROOT a tuple, not a string.
Just fixing it to be the right type, but still dynamically computed based on
your project's location, would have been sufficient.


> I use the same method above to grab templates, and that works ok
>
>
Note TEMPLATE_DIRS is supposed to be a tuple:
http://docs.djangoproject.com/en/1.2/ref/settings/#template-dirs

while MEDIA_ROOT is supposed to be a string:
http://docs.djangoproject.com/en/1.2/ref/settings/#media-root

You need to adjust your method when cribbing from one setting to another and
ensure you give each setting a value of the appropriate type.

Note also this is why I suggested taking a look at (not necessarily posting
to the list) the values of the local variables on the debug page. The code
you were focused on (model and model admin defs) was correct, and the
problem was elsewhere. Seeing the actual value of s that was being used
(presumably the tuple MEDIA_ROOT had been set to) might have given you a
clue as to where the problem was.

If you have difficulty understanding all that is presented by the debug page
and how to make use of it, there is a book linked from the page in my sig
that may be helpful to you in improving your debugging skills.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread vanderkerkoff
I got it :-)

import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))

# MEDIA_ROOT = (
#   os.path.join(PROJECT_PATH, 'static/media/'),
# )

MEDIA_ROOT = '/Users/mjdavies/Sites/django/governors/static/media/'

statically pointing the media root works


I use the same method above to grab templates, and that works ok

at least we got it sorted

thanks again



On Feb 6, 5:16 pm, vanderkerkoff  wrote:
> Hi Karen
>
> I promise you I'm changing the code that I'm displaying, I've been
> updating the app all day,  just tying off some loose ends now.
>
> I've tried copying and pasting all the variables but it looks like
> garbage in dpaste.
>
> One thing that I'm not sure if right is the value of the the_file
> variable in the output
>
> Variable        Value
> the_file
> 
>
> Not sure if that is correct
>
> I seem to remember hearing about a situation where you had to save the
> file to the filesystem and the record of the file to the  database in
> a certain order
>
> hmm
>
> will keep digging
>
> this is a brand new mac install if that's anything to go by
>
> thanks for helping, it is really appreciated
>
> On Feb 6, 4:39 pm, Karen Tracey  wrote:
>
>
>
> > On Sun, Feb 6, 2011 at 11:11 AM, vanderkerkoff  wrote:
> > > Hi Karen
>
> > > Thanks for getting back
>
> > > Here's the model def
>
> > >http://dpaste.com/391872/
>
> > I cut and pasted that model definition, plus the model admin shown earlier,
> > into a test project, and I'm able to add Documents in the admin with no
> > error. It seems that somehow you are running code other than what you have
> > posted. In the debug page you can look at the values of local variables, so
> > maybe you cold get a hint of what's happening by taking a look at the actual
> > value of s (the tuple python is complaining  does not have a startwith
> > attribute).
>
> > Karen
>
> > --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread vanderkerkoff
Hi Karen

I promise you I'm changing the code that I'm displaying, I've been
updating the app all day,  just tying off some loose ends now.

I've tried copying and pasting all the variables but it looks like
garbage in dpaste.

One thing that I'm not sure if right is the value of the the_file
variable in the output

VariableValue
the_file


Not sure if that is correct

I seem to remember hearing about a situation where you had to save the
file to the filesystem and the record of the file to the  database in
a certain order

hmm

will keep digging

this is a brand new mac install if that's anything to go by

thanks for helping, it is really appreciated

On Feb 6, 4:39 pm, Karen Tracey  wrote:
> On Sun, Feb 6, 2011 at 11:11 AM, vanderkerkoff  wrote:
> > Hi Karen
>
> > Thanks for getting back
>
> > Here's the model def
>
> >http://dpaste.com/391872/
>
> I cut and pasted that model definition, plus the model admin shown earlier,
> into a test project, and I'm able to add Documents in the admin with no
> error. It seems that somehow you are running code other than what you have
> posted. In the debug page you can look at the values of local variables, so
> maybe you cold get a hint of what's happening by taking a look at the actual
> value of s (the tuple python is complaining  does not have a startwith
> attribute).
>
> Karen
>
> --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread Karen Tracey
On Sun, Feb 6, 2011 at 11:11 AM, vanderkerkoff  wrote:

> Hi Karen
>
> Thanks for getting back
>
> Here's the model def
>
> http://dpaste.com/391872/
>
>
I cut and pasted that model definition, plus the model admin shown earlier,
into a test project, and I'm able to add Documents in the admin with no
error. It seems that somehow you are running code other than what you have
posted. In the debug page you can look at the values of local variables, so
maybe you cold get a hint of what's happening by taking a look at the actual
value of s (the tuple python is complaining  does not have a startwith
attribute).

Karen

-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread vanderkerkoff
Hiya both

I'm outputting all the data types I'm saving now in a save in the
admin.py, they're all strings :-(

I'm going to kick myself when I find it




On Feb 6, 4:11 pm, vanderkerkoff  wrote:
> Hi Karen
>
> Thanks for getting back
>
> Here's the model def
>
> http://dpaste.com/391872/
>
> On Feb 6, 3:33 pm, Karen Tracey  wrote:
>
>
>
> > On Sun, Feb 6, 2011 at 9:50 AM, vanderkerkoff  wrote:
> > > I'm trying to upload a file in a project, the app is called Documents,
> > > here's the admin.py
>
> > > [snipped]
>
> > More interesting than the admin.py for this model would have been the model
> > definition itself.
>
> > > I keep getting an error I don't understand
>
> > > Exception Type: AttributeError at /admin/documents/document/add/
> > > Exception Value: 'tuple' object has no attribute 'startswith'
>
> > > Here's the stack trace
>
> > >http://dpaste.com/391662/
>
> > > Anyone got any ideas?
>
> > Stack trace seems to be indicating a problem with your file field's
> > upload_to value. Doc for that value is 
> > here:http://docs.djangoproject.com/en/1.2/ref/models/fields/#filefield. 
> > Traceback
> > seems to be saying you've got it defined as a tuple rather than a string or
> > callable.
>
> > Karen
> > --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread vanderkerkoff
Hi Karen

Thanks for getting back

Here's the model def

http://dpaste.com/391872/



On Feb 6, 3:33 pm, Karen Tracey  wrote:
> On Sun, Feb 6, 2011 at 9:50 AM, vanderkerkoff  wrote:
> > I'm trying to upload a file in a project, the app is called Documents,
> > here's the admin.py
>
> > [snipped]
>
> More interesting than the admin.py for this model would have been the model
> definition itself.
>
>
>
> > I keep getting an error I don't understand
>
> > Exception Type: AttributeError at /admin/documents/document/add/
> > Exception Value: 'tuple' object has no attribute 'startswith'
>
> > Here's the stack trace
>
> >http://dpaste.com/391662/
>
> > Anyone got any ideas?
>
> Stack trace seems to be indicating a problem with your file field's
> upload_to value. Doc for that value is 
> here:http://docs.djangoproject.com/en/1.2/ref/models/fields/#filefield. 
> Traceback
> seems to be saying you've got it defined as a tuple rather than a string or
> callable.
>
> Karen
> --http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread Chris Hannam
Hi,
startswith is usually a string method. Looks like something is calling
.startwith() on a tuple rather than the expected string.

When you instantiate your model are you certain all the values are correct?
Try logging all the values before creating the model and look for a tuple
where there should be a string.

CH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload

2011-02-06 Thread Karen Tracey
On Sun, Feb 6, 2011 at 9:50 AM, vanderkerkoff  wrote:

> I'm trying to upload a file in a project, the app is called Documents,
> here's the admin.py
>
> [snipped]
More interesting than the admin.py for this model would have been the model
definition itself.


>
> I keep getting an error I don't understand
>
> Exception Type: AttributeError at /admin/documents/document/add/
> Exception Value: 'tuple' object has no attribute 'startswith'
>
> Here's the stack trace
>
> http://dpaste.com/391662/
>
> Anyone got any ideas?
>

Stack trace seems to be indicating a problem with your file field's
upload_to value. Doc for that value is here:
http://docs.djangoproject.com/en/1.2/ref/models/fields/#filefield. Traceback
seems to be saying you've got it defined as a tuple rather than a string or
callable.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-10 Thread Sithembewena Lloyd Dube
Good idea, Kenneth. I will do so. Thanks.

On Fri, Dec 10, 2010 at 8:00 AM, Kenneth Gonsalves wrote:

> On Thu, 2010-12-09 at 14:57 +0200, Sithembewena Lloyd Dube wrote:
> > Thanks Kenneth. I tried your recommendation, the file is not uploaded
> > at
> > all. I'm stumped by this, as
> > the folder is writable by apache. I will post on here when I do
> > implement a
> > fix.
> >
> >
>
> do one thing - make the file required and not optional, then django will
> barf and tell you where you have gone wrong
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 14:57 +0200, Sithembewena Lloyd Dube wrote:
> Thanks Kenneth. I tried your recommendation, the file is not uploaded
> at
> all. I'm stumped by this, as
> the folder is writable by apache. I will post on here when I do
> implement a
> fix.
> 
> 

do one thing - make the file required and not optional, then django will
barf and tell you where you have gone wrong
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Thanks Kenneth. I tried your recommendation, the file is not uploaded at
all. I'm stumped by this, as
the folder is writable by apache. I will post on here when I do implement a
fix.

On Thu, Dec 9, 2010 at 1:46 PM, Kenneth Gonsalves  wrote:

> On Thu, 2010-12-09 at 13:42 +0200, Sithembewena Lloyd Dube wrote:
> > Thanks Kenneth, am trying to figure out how to set the MEDIA_ROOT to
> > the
> > folder outside the project.
>
> /home/lloyd/smedia/ and make it writable by the webserver
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 13:42 +0200, Sithembewena Lloyd Dube wrote:
> Thanks Kenneth, am trying to figure out how to set the MEDIA_ROOT to
> the
> folder outside the project. 

/home/lloyd/smedia/ and make it writable by the webserver 
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Thanks Kenneth, am trying to figure out how to set the MEDIA_ROOT to the
folder outside the project.



On Thu, Dec 9, 2010 at 12:58 PM, Kenneth Gonsalves wrote:

> On Thu, 2010-12-09 at 12:47 +0200, Sithembewena Lloyd Dube wrote:
> > Is it proper/ feasible to save media to and serve it from, a media
> > folder
> > outside of the project?
>
> it is proper - as this will not come under version control whereas the
> project will
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 12:47 +0200, Sithembewena Lloyd Dube wrote:
> Is it proper/ feasible to save media to and serve it from, a media
> folder
> outside of the project? 

it is proper - as this will not come under version control whereas the
project will
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Issue isolated. The uploads are going into the MEDIA_ROOT, which is the
'media' folder in my app.

The MEDIA_URL is pointing to a location outside of the project.

Is it proper/ feasible to save media to and serve it from, a media folder
outside of the project?

On Thu, Dec 9, 2010 at 12:01 PM, Sithembewena Lloyd Dube
wrote:

> Hi Kenneth,
>
> The FileField is optional indeed. Surely it should be populated where a
> file is provided though?
>
> Update: turns out I have not installed the PIL on my staging server. Am
> doing so now and retesting. this may well turn out to be a PEBKAC :)
>
> Thanks.
>
>
> On Thu, Dec 9, 2010 at 11:46 AM, Kenneth Gonsalves wrote:
>
>> On Thu, 2010-12-09 at 15:11 +0530, Kenneth Gonsalves wrote:
>> > On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
>> > > However, my live application fails to upload the file (ie the
>> > > FileField is
>> > > empty in the database after uploading, and the file is not
>> > uploaded).
>> >
>> > path problem or permission problem
>>
>> I am assuming the filefield is optional
>> --
>> regards
>> Kenneth Gonsalves
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
Hi Kenneth,

The FileField is optional indeed. Surely it should be populated where a file
is provided though?

Update: turns out I have not installed the PIL on my staging server. Am
doing so now and retesting. this may well turn out to be a PEBKAC :)

Thanks.

On Thu, Dec 9, 2010 at 11:46 AM, Kenneth Gonsalves wrote:

> On Thu, 2010-12-09 at 15:11 +0530, Kenneth Gonsalves wrote:
> > On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
> > > However, my live application fails to upload the file (ie the
> > > FileField is
> > > empty in the database after uploading, and the file is not
> > uploaded).
> >
> > path problem or permission problem
>
> I am assuming the filefield is optional
> --
> regards
> Kenneth Gonsalves
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 15:11 +0530, Kenneth Gonsalves wrote:
> On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
> > However, my live application fails to upload the file (ie the
> > FileField is
> > empty in the database after uploading, and the file is not
> uploaded). 
> 
> path problem or permission problem 

I am assuming the filefield is optional
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Kenneth Gonsalves
On Thu, 2010-12-09 at 10:20 +0200, Sithembewena Lloyd Dube wrote:
> However, my live application fails to upload the file (ie the
> FileField is
> empty in the database after uploading, and the file is not uploaded). 

path problem or permission problem
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload fail on live server

2010-12-09 Thread Sithembewena Lloyd Dube
PS: I also a have a separate model which is using an ImageField subclass to
upload an avatar. On my development machine, I can edit a record and change
the thumbnail without issues. On the live server, nice the thumbnail is
saved it cannot be changed.

Ideas?

On Thu, Dec 9, 2010 at 10:20 AM, Sithembewena Lloyd Dube
wrote:

> Hi guys,
>
> I have a form where I use a FileField to upload a file to the server and
> this works fine on my local machine.
>
> However, my live application fails to upload the file (ie the FileField is
> empty in the database after uploading, and the file is not uploaded).
>
> I know this is a pot shot, but would anybody have an idea what is going on?
>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
>



-- 
Regards,
Sithembewena Lloyd Dube

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload Content Type Verification

2010-09-24 Thread Federico Capoano
Thanks.

I'm concerned about the possibility of uploading and executing a
script on the server. Just this. I think I can avoid this by hiding
the file somewhere behind the public folder so the content is not
accessible via http.



On 24 Set, 13:31, Tom Evans  wrote:
> On Fri, Sep 24, 2010 at 12:23 PM, Federico Capoano
>
>  wrote:
> > I can't trust the user because this field will be used in the
> > frontend, which will be an app similar to the django admin, but much
> > more limited.
>
> > So according to what you said, there is no standard way to do this.
> > the second solution seems interesting.
>
> > But what if I wanted to restrict to images?
>
> > What's the best way to avoid security issues? Maybe store the file
> > somewhere hidden would be safer?
>
> Depends what you mean by 'standard'. I would consider it standard to
> validate user supplied input, and that process is the same regardless
> of filetype, the only thing that changes is how you validate the
> input.
>
> For images, you can simply use a ImageField, which uses PIL to
> validate that the uploaded file is an image file supported by PIL.
>
> I don't understand what security issues you are referring to.
>
> Cheers
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload Content Type Verification

2010-09-24 Thread Tom Evans
On Fri, Sep 24, 2010 at 12:23 PM, Federico Capoano
 wrote:
> I can't trust the user because this field will be used in the
> frontend, which will be an app similar to the django admin, but much
> more limited.
>
> So according to what you said, there is no standard way to do this.
> the second solution seems interesting.
>
> But what if I wanted to restrict to images?
>
> What's the best way to avoid security issues? Maybe store the file
> somewhere hidden would be safer?
>

Depends what you mean by 'standard'. I would consider it standard to
validate user supplied input, and that process is the same regardless
of filetype, the only thing that changes is how you validate the
input.

For images, you can simply use a ImageField, which uses PIL to
validate that the uploaded file is an image file supported by PIL.

I don't understand what security issues you are referring to.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Re: File Upload Content Type Verification

2010-09-24 Thread Henrik Genssen
for images PIL does the job more or less well for all the filetypes
and formats it knows (validation build in ImageField) I have recognized problems
with some image file types...

you may also do some virus scan...
we added clamav (pyclamd) to the clean method...

regards

Henrik

>reply to message:
>date: 24.09.2010 06:23:55
>from: "Federico Capoano" 
>to: "Django users" 
>subject: Re: File Upload Content Type Verification
>
>I can't trust the user because this field will be used in the
>frontend, which will be an app similar to the django admin, but much
>more limited.
>
>So according to what you said, there is no standard way to do this.
>the second solution seems interesting.
>
>But what if I wanted to restrict to images?
>
>What's the best way to avoid security issues? Maybe store the file
>somewhere hidden would be safer?
>
>
>
>
>On 24 Set, 13:08, Tom Evans  wrote:
>> On Fri, Sep 24, 2010 at 11:28 AM, Federico Capoano
>>
>>  wrote:
>> > Is there a way we can check if a certain file being uploaded is really
>> > what it claims to be?
>> > Let's say I want to restrict files to PDF only, then I take a php
>> > script and I rename it PDF I can still upload it if using the
>> > following custom FileField that I just worked out yesterday:
>>
>> If you're not willing to trust the user, then you must validate the
>> uploaded file. I can think of three straightforward ways to do so:
>>
>> 1) Use file(1) to determine the true file type. This will be just a
>> guess from the opening few bytes of the file, and could be fooled by
>> clever manipulation of the uploaded file.
>>
>> 2) Use ghostscript and it's utilities to validate the pdf file.
>> Something along these lines:
>>
>>   try:
>>       is_pdf = (subprocess.check_call(['pdf2ps', '/path/to/file.pdf',
>> '/dev/null']) == 0)
>>   except subprocessCalledProcessError:
>>       is_pdf = False
>>
>> 3) Use a pure python library like pyPdf to examine it. I wouldn't
>> recommend this, it's a bit old and crufty.
>>
>> Cheers
>>
>> Tom
>
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To post to this group, send email to django-us...@googlegroups.com.
>To unsubscribe from this group, send email to 
>django-users+unsubscr...@googlegroups.com.
>For more options, visit this group at 
>http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload Content Type Verification

2010-09-24 Thread Federico Capoano
I can't trust the user because this field will be used in the
frontend, which will be an app similar to the django admin, but much
more limited.

So according to what you said, there is no standard way to do this.
the second solution seems interesting.

But what if I wanted to restrict to images?

What's the best way to avoid security issues? Maybe store the file
somewhere hidden would be safer?




On 24 Set, 13:08, Tom Evans  wrote:
> On Fri, Sep 24, 2010 at 11:28 AM, Federico Capoano
>
>  wrote:
> > Is there a way we can check if a certain file being uploaded is really
> > what it claims to be?
> > Let's say I want to restrict files to PDF only, then I take a php
> > script and I rename it PDF I can still upload it if using the
> > following custom FileField that I just worked out yesterday:
>
> If you're not willing to trust the user, then you must validate the
> uploaded file. I can think of three straightforward ways to do so:
>
> 1) Use file(1) to determine the true file type. This will be just a
> guess from the opening few bytes of the file, and could be fooled by
> clever manipulation of the uploaded file.
>
> 2) Use ghostscript and it's utilities to validate the pdf file.
> Something along these lines:
>
>   try:
>       is_pdf = (subprocess.check_call(['pdf2ps', '/path/to/file.pdf',
> '/dev/null']) == 0)
>   except subprocessCalledProcessError:
>       is_pdf = False
>
> 3) Use a pure python library like pyPdf to examine it. I wouldn't
> recommend this, it's a bit old and crufty.
>
> Cheers
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload Content Type Verification

2010-09-24 Thread Tom Evans
On Fri, Sep 24, 2010 at 11:28 AM, Federico Capoano
 wrote:
> Is there a way we can check if a certain file being uploaded is really
> what it claims to be?
> Let's say I want to restrict files to PDF only, then I take a php
> script and I rename it PDF I can still upload it if using the
> following custom FileField that I just worked out yesterday:
>


If you're not willing to trust the user, then you must validate the
uploaded file. I can think of three straightforward ways to do so:

1) Use file(1) to determine the true file type. This will be just a
guess from the opening few bytes of the file, and could be fooled by
clever manipulation of the uploaded file.

2) Use ghostscript and it's utilities to validate the pdf file.
Something along these lines:

  try:
  is_pdf = (subprocess.check_call(['pdf2ps', '/path/to/file.pdf',
'/dev/null']) == 0)
  except subprocessCalledProcessError:
  is_pdf = False

3) Use a pure python library like pyPdf to examine it. I wouldn't
recommend this, it's a bit old and crufty.


Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File upload from python client to Django app

2010-06-21 Thread euan.godd...@googlemail.com
urllib2 can handle cookies and therefore you should be able to handle
the login. It will probably be a fair bit of work to get the client to
submit the various parts, but I'm sure I've seen some examples around
on how to do such a thing.

Euan

On Jun 21, 3:52 pm, srn  wrote:
> Hello to all,
>
> I'm trying to do a POST from a python client to a Django webapp using
> urllib2 but I'm getting http 403  error.
> On the Django side I'm using a Form so I suspect the problem is {%
> csrf_token %} (csrf middleware enabled) which I can't provide from the
> client side.
>
> Is there other way to do this?
>
> Your advice is much appreciated,
> Regards,
> Sorin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-10 Thread Venkatraman S
I got this working with SWFUpload. I shall upload a test app which does this
and update this thread.
In the meantime, if you want some quick help, then let me know. or can refer
to : http://github.com/naltimari/django-swfupload-samples

-V-
http://twitter.com/venkasub


On Fri, Jun 4, 2010 at 4:41 PM, Venkatraman S  wrote:

> Anyone who wants to work on this problem with me? We can probably
> collaborate and release it over this weekend.
>
>
>
> On Fri, Jun 4, 2010 at 3:16 AM, Brad Pitcher wrote:
>
>> Some versions of flash have a bug that causes the entire browser to
>> freeze while uploading.  I am afflicted by the bug, running Flash 10.0
>> r45 on Ubuntu 10.04.  It seems that there is no good solution at the
>> moment.  My host is Webfaction and I just discovered that they have a
>> non-configurable nginx server in front of everything that caches
>> uploads before sending them on to apache/django making it impossible
>> to do upload progress bars at the moment.  They are aware of the
>> problem, but who knows when it will be fixed.
>>
>> On Jun 3, 8:31 am, Venkatraman S  wrote:
>> > Oh yes! I was referring to a stand alone app. I heard someone complain
>> > #django that filebrowser aint working right after uploadify was
>> introduced.
>> > Is that True?
>> >
>> > On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:
>> > >http://code.google.com/p/django-filebrowser/
>> >
>> > > cheers,
>> > > patrick
>> >
>> > > On 3 Jun., 16:10, Venkatraman S  wrote:
>> > > > Hi Patrick,
>> >
>> > > > Can you share a simple django app which uses Uploadify?  Did you use
>> > > vanilla
>> > > > Uploadify or 
>> > > > django-uploadify(github.com/tstone/django-uploadify*)*
>> 
>> > > ?
>> > > > I have been simply unable to make it run.  I also tried a
>> > > django-uploadify,
>> > > > but no results! Frustrating it is.
>> >
>> > > > If you can share the code, i would rather use it along with some
>> other
>> > > > experiments that I have been doing and publish it in the public
>> domain.
>> >
>> > > > Regards.
>> >
>> > > > On Thu, Jun 3, 2010 at 5:39 PM, patrickk 
>> wrote:
>> > > > > you could use uploadify, seehttp://www.uploadify.com/.
>> >
>> > > > > of course, it´s not an ideal solution since its flash-based.
>> > > > > we´ve been using uploadify with django and the filebrowser for
>> about a
>> > > > > year now and it works quite well.
>> >
>> > > > > regards,
>> > > > > patrick
>> >
>> > > > > On 3 Jun., 06:32, Venkatraman S  wrote:
>> > > > > > Tell me about it! Its quite insane that there is no
>> single-standard
>> > > > > solution
>> > > > > > for this.
>> > > > > > I have been hanging around in #django for sometime and there is
>> still
>> > > > > > opposition to flash based solution. Also, i have not been to get
>> it
>> > > > > working
>> > > > > > inspite of it being not an ideal solution.
>> > > > > > I hear that there are some issues with filebrowser since it uses
>> > > > > Uploadify.
>> > > > > > Also, i dont see any solution which works in both dev server and
>> also
>> > > in
>> > > > > the
>> > > > > > production using httpd/apache.
>> >
>> > > > > > Going insane! Let me know if you get anything working.
>> >
>> > > > > > PS: As i said, html5 is cool and works, but the client does not
>> want
>> > > to
>> > > > > use
>> > > > > > it!
>> >
>> > > > > > -V-http://twitter.com/venkasub
>> >
>> > > > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher <
>> bradpitc...@gmail.com>
>> > > > > wrote:
>> > > > > > > Sort of, that's what the default is in the demo, but now I've
>> > > noticed I
>> > > > > > > have the same problem with apache progress reporting as I did
>> using
>> > > > > django
>> > > > > > > progress reporting.  It's behaving like it's not
>> multi-threaded or
>> > > > > > > something.  It seems like I don't get any progress reports
>> until
>> > > the
>> > > > > file
>> > > > > > > has finished uploading.  It's actually driving me a bit crazy
>> so
>> > > I'm
>> > > > > going
>> > > > > > > to have to move on to something else for a while.
>> >
>> > > > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S <
>> venka...@gmail.com>
>> > > > > wrote:
>> >
>> > > > > > >> Does this work with the Django development server?
>> >
>> > > > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
>> > > bradpitc...@gmail.com
>> > > > > >wrote:
>> >
>> > > > > > >>> Since I just spent much longer than it should have taken
>> figuring
>> > > > > this
>> > > > > > >>> out, I will try and help you out.  I followed the
>> instructions at
>> > > the
>> > > > > > >>> provided link and it sort of worked.  Not quite as well as I
>> > > liked.
>> > > > >  I
>> > > > > > >>> used Apache for the progress reporting, which the author
>> doesn't
>> > > > > > >>> mention in the article but it is discussed here:
>> >
>> > > > >
>> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass.
>> > > ..
>> > > > > > >>> (it in

Re: File Upload with Progress Bar

2010-06-04 Thread Venkatraman S
Anyone who wants to work on this problem with me? We can probably
collaborate and release it over this weekend.


On Fri, Jun 4, 2010 at 3:16 AM, Brad Pitcher  wrote:

> Some versions of flash have a bug that causes the entire browser to
> freeze while uploading.  I am afflicted by the bug, running Flash 10.0
> r45 on Ubuntu 10.04.  It seems that there is no good solution at the
> moment.  My host is Webfaction and I just discovered that they have a
> non-configurable nginx server in front of everything that caches
> uploads before sending them on to apache/django making it impossible
> to do upload progress bars at the moment.  They are aware of the
> problem, but who knows when it will be fixed.
>
> On Jun 3, 8:31 am, Venkatraman S  wrote:
> > Oh yes! I was referring to a stand alone app. I heard someone complain
> > #django that filebrowser aint working right after uploadify was
> introduced.
> > Is that True?
> >
> > On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:
> > >http://code.google.com/p/django-filebrowser/
> >
> > > cheers,
> > > patrick
> >
> > > On 3 Jun., 16:10, Venkatraman S  wrote:
> > > > Hi Patrick,
> >
> > > > Can you share a simple django app which uses Uploadify?  Did you use
> > > vanilla
> > > > Uploadify or 
> > > > django-uploadify(github.com/tstone/django-uploadify*)*
> 
> > > ?
> > > > I have been simply unable to make it run.  I also tried a
> > > django-uploadify,
> > > > but no results! Frustrating it is.
> >
> > > > If you can share the code, i would rather use it along with some
> other
> > > > experiments that I have been doing and publish it in the public
> domain.
> >
> > > > Regards.
> >
> > > > On Thu, Jun 3, 2010 at 5:39 PM, patrickk 
> wrote:
> > > > > you could use uploadify, seehttp://www.uploadify.com/.
> >
> > > > > of course, it´s not an ideal solution since its flash-based.
> > > > > we´ve been using uploadify with django and the filebrowser for
> about a
> > > > > year now and it works quite well.
> >
> > > > > regards,
> > > > > patrick
> >
> > > > > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > > > > Tell me about it! Its quite insane that there is no
> single-standard
> > > > > solution
> > > > > > for this.
> > > > > > I have been hanging around in #django for sometime and there is
> still
> > > > > > opposition to flash based solution. Also, i have not been to get
> it
> > > > > working
> > > > > > inspite of it being not an ideal solution.
> > > > > > I hear that there are some issues with filebrowser since it uses
> > > > > Uploadify.
> > > > > > Also, i dont see any solution which works in both dev server and
> also
> > > in
> > > > > the
> > > > > > production using httpd/apache.
> >
> > > > > > Going insane! Let me know if you get anything working.
> >
> > > > > > PS: As i said, html5 is cool and works, but the client does not
> want
> > > to
> > > > > use
> > > > > > it!
> >
> > > > > > -V-http://twitter.com/venkasub
> >
> > > > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher <
> bradpitc...@gmail.com>
> > > > > wrote:
> > > > > > > Sort of, that's what the default is in the demo, but now I've
> > > noticed I
> > > > > > > have the same problem with apache progress reporting as I did
> using
> > > > > django
> > > > > > > progress reporting.  It's behaving like it's not multi-threaded
> or
> > > > > > > something.  It seems like I don't get any progress reports
> until
> > > the
> > > > > file
> > > > > > > has finished uploading.  It's actually driving me a bit crazy
> so
> > > I'm
> > > > > going
> > > > > > > to have to move on to something else for a while.
> >
> > > > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S <
> venka...@gmail.com>
> > > > > wrote:
> >
> > > > > > >> Does this work with the Django development server?
> >
> > > > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
> > > bradpitc...@gmail.com
> > > > > >wrote:
> >
> > > > > > >>> Since I just spent much longer than it should have taken
> figuring
> > > > > this
> > > > > > >>> out, I will try and help you out.  I followed the
> instructions at
> > > the
> > > > > > >>> provided link and it sort of worked.  Not quite as well as I
> > > liked.
> > > > >  I
> > > > > > >>> used Apache for the progress reporting, which the author
> doesn't
> > > > > > >>> mention in the article but it is discussed here:
> >
> > > > >
> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass.
> > > ..
> > > > > > >>> (it involves compiling and installing an apache module).
> > > > > > >>> The author also doesn't mention changes needed in
> settings.py:
> > > > > > >>> from django.conf import global_settings
> >
> > > > > > >>> FILE_UPLOAD_HANDLERS =
> ('path.to.UploadProgressCachedHandler', )
> > > +
> > > > > > >>> \<-- change path here
> > > > > > >>>global_settings.FILE_UPLOAD_HANDLERS
> >
> > > > > > >>> If you are using nginx or apache for the server side instead
> o

Re: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
Some versions of flash have a bug that causes the entire browser to
freeze while uploading.  I am afflicted by the bug, running Flash 10.0
r45 on Ubuntu 10.04.  It seems that there is no good solution at the
moment.  My host is Webfaction and I just discovered that they have a
non-configurable nginx server in front of everything that caches
uploads before sending them on to apache/django making it impossible
to do upload progress bars at the moment.  They are aware of the
problem, but who knows when it will be fixed.

On Jun 3, 8:31 am, Venkatraman S  wrote:
> Oh yes! I was referring to a stand alone app. I heard someone complain
> #django that filebrowser aint working right after uploadify was introduced.
> Is that True?
>
> On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:
> >http://code.google.com/p/django-filebrowser/
>
> > cheers,
> > patrick
>
> > On 3 Jun., 16:10, Venkatraman S  wrote:
> > > Hi Patrick,
>
> > > Can you share a simple django app which uses Uploadify?  Did you use
> > vanilla
> > > Uploadify or 
> > > django-uploadify(github.com/tstone/django-uploadify*)*
> > ?
> > > I have been simply unable to make it run.  I also tried a
> > django-uploadify,
> > > but no results! Frustrating it is.
>
> > > If you can share the code, i would rather use it along with some other
> > > experiments that I have been doing and publish it in the public domain.
>
> > > Regards.
>
> > > On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:
> > > > you could use uploadify, seehttp://www.uploadify.com/.
>
> > > > of course, it´s not an ideal solution since its flash-based.
> > > > we´ve been using uploadify with django and the filebrowser for about a
> > > > year now and it works quite well.
>
> > > > regards,
> > > > patrick
>
> > > > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > > > Tell me about it! Its quite insane that there is no single-standard
> > > > solution
> > > > > for this.
> > > > > I have been hanging around in #django for sometime and there is still
> > > > > opposition to flash based solution. Also, i have not been to get it
> > > > working
> > > > > inspite of it being not an ideal solution.
> > > > > I hear that there are some issues with filebrowser since it uses
> > > > Uploadify.
> > > > > Also, i dont see any solution which works in both dev server and also
> > in
> > > > the
> > > > > production using httpd/apache.
>
> > > > > Going insane! Let me know if you get anything working.
>
> > > > > PS: As i said, html5 is cool and works, but the client does not want
> > to
> > > > use
> > > > > it!
>
> > > > > -V-http://twitter.com/venkasub
>
> > > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> > > > wrote:
> > > > > > Sort of, that's what the default is in the demo, but now I've
> > noticed I
> > > > > > have the same problem with apache progress reporting as I did using
> > > > django
> > > > > > progress reporting.  It's behaving like it's not multi-threaded or
> > > > > > something.  It seems like I don't get any progress reports until
> > the
> > > > file
> > > > > > has finished uploading.  It's actually driving me a bit crazy so
> > I'm
> > > > going
> > > > > > to have to move on to something else for a while.
>
> > > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> > > > wrote:
>
> > > > > >> Does this work with the Django development server?
>
> > > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
> > bradpitc...@gmail.com
> > > > >wrote:
>
> > > > > >>> Since I just spent much longer than it should have taken figuring
> > > > this
> > > > > >>> out, I will try and help you out.  I followed the instructions at
> > the
> > > > > >>> provided link and it sort of worked.  Not quite as well as I
> > liked.
> > > >  I
> > > > > >>> used Apache for the progress reporting, which the author doesn't
> > > > > >>> mention in the article but it is discussed here:
>
> > > >http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass.
> > ..
> > > > > >>> (it involves compiling and installing an apache module).
> > > > > >>> The author also doesn't mention changes needed in settings.py:
> > > > > >>> from django.conf import global_settings
>
> > > > > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', )
> > +
> > > > > >>> \    <-- change path here
> > > > > >>>    global_settings.FILE_UPLOAD_HANDLERS
>
> > > > > >>> If you are using nginx or apache for the server side instead of
> > > > > >>> django, you will need to modify progressUrl to point to whatever
> > url
> > > > > >>> you set up for accessing progress reports.
>
> > > > > >>> If you are looking for a demo, there is one linked in the article
> > > > > >>> creecode posted.
> > > > > >>> -Brad
>
> > > > > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > > > > >>> > HI creecode,
>
> > > > > >>> > Can you share the project please? I can probably work on it and
> > see
> > > > > >>> what is
> > > > > >>> > happening.
> > > > > >>> > Till now, i havent eve

Re: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
Whoops!  Just read that the django dev server is not multithreaded so
it will not work.  But you should be able to use any web server along
with an upload_progress view as long as your web server streams the
upload in progress to django.  I think my troubles may be because the
web server isn't streaming the file upload to django, I'm currently
investigating that.

On Jun 2, 9:24 pm, Brad Pitcher  wrote:
> Sort of, that's what the default is in the demo, but now I've noticed I have
> the same problem with apache progress reporting as I did using django
> progress reporting.  It's behaving like it's not multi-threaded or
> something.  It seems like I don't get any progress reports until the file
> has finished uploading.  It's actually driving me a bit crazy so I'm going
> to have to move on to something else for a while.
>
> On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:
> > Does this work with the Django development server?
>
> > On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>
> >> Since I just spent much longer than it should have taken figuring this
> >> out, I will try and help you out.  I followed the instructions at the
> >> provided link and it sort of worked.  Not quite as well as I liked.  I
> >> used Apache for the progress reporting, which the author doesn't
> >> mention in the article but it is discussed here:
>
> >>http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> >> (it involves compiling and installing an apache module).
> >> The author also doesn't mention changes needed in settings.py:
> >> from django.conf import global_settings
>
> >> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> >> \    <-- change path here
> >>    global_settings.FILE_UPLOAD_HANDLERS
>
> >> If you are using nginx or apache for the server side instead of
> >> django, you will need to modify progressUrl to point to whatever url
> >> you set up for accessing progress reports.
>
> >> If you are looking for a demo, there is one linked in the article
> >> creecode posted.
> >> -Brad
>
> >> On May 30, 12:23 pm, Venkatraman S  wrote:
> >> > HI creecode,
>
> >> > Can you share the project please? I can probably work on it and see what
> >> is
> >> > happening.
> >> > Till now, i havent even been able to get this working.
>
> >> > -V
>
> >> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> >> > > Hello V,
>
> >> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> >> > > > I have been trying to build a simple file upload with progress bar.
>
> >> > > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
> >> ..
> >> > > > will point you in the right direction.
>
> >> > > I've experimented with a solution based tthe above but I wasn't
> >> > > entirely satisfied with my implementation.  I'm having a problem with
> >> > > the progress bar not reaching 100% many times and some problems with
> >> > > the percentage complete number.
>
> >> > > I've put my project on the back burner for now but if anyone has any
> >> > > examples they'd like to share I'd be interested in seeing them.
>
> >> > > Toodle-looo...
> >> > > creecode
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> Groups
> >> > > "Django users" group.
> >> > > To post to this group, send email to django-us...@googlegroups.com.
> >> > > To unsubscribe from this group, send email to
> >> > > django-users+unsubscr...@googlegroups.com
> >> 
>
> >> > > .
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/django-users?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Django users" group.
> >> To post to this group, send email to django-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-03 Thread Venkatraman S
Oh yes! I was referring to a stand alone app. I heard someone complain
#django that filebrowser aint working right after uploadify was introduced.
Is that True?

On Thu, Jun 3, 2010 at 8:11 PM, patrickk  wrote:

> http://code.google.com/p/django-filebrowser/
>
> cheers,
> patrick
>
> On 3 Jun., 16:10, Venkatraman S  wrote:
> > Hi Patrick,
> >
> > Can you share a simple django app which uses Uploadify?  Did you use
> vanilla
> > Uploadify or 
> > django-uploadify(github.com/tstone/django-uploadify*)*
> ?
> > I have been simply unable to make it run.  I also tried a
> django-uploadify,
> > but no results! Frustrating it is.
> >
> > If you can share the code, i would rather use it along with some other
> > experiments that I have been doing and publish it in the public domain.
> >
> > Regards.
> >
> > On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:
> > > you could use uploadify, seehttp://www.uploadify.com/.
> >
> > > of course, it´s not an ideal solution since its flash-based.
> > > we´ve been using uploadify with django and the filebrowser for about a
> > > year now and it works quite well.
> >
> > > regards,
> > > patrick
> >
> > > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > > Tell me about it! Its quite insane that there is no single-standard
> > > solution
> > > > for this.
> > > > I have been hanging around in #django for sometime and there is still
> > > > opposition to flash based solution. Also, i have not been to get it
> > > working
> > > > inspite of it being not an ideal solution.
> > > > I hear that there are some issues with filebrowser since it uses
> > > Uploadify.
> > > > Also, i dont see any solution which works in both dev server and also
> in
> > > the
> > > > production using httpd/apache.
> >
> > > > Going insane! Let me know if you get anything working.
> >
> > > > PS: As i said, html5 is cool and works, but the client does not want
> to
> > > use
> > > > it!
> >
> > > > -V-http://twitter.com/venkasub
> >
> > > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> > > wrote:
> > > > > Sort of, that's what the default is in the demo, but now I've
> noticed I
> > > > > have the same problem with apache progress reporting as I did using
> > > django
> > > > > progress reporting.  It's behaving like it's not multi-threaded or
> > > > > something.  It seems like I don't get any progress reports until
> the
> > > file
> > > > > has finished uploading.  It's actually driving me a bit crazy so
> I'm
> > > going
> > > > > to have to move on to something else for a while.
> >
> > > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> > > wrote:
> >
> > > > >> Does this work with the Django development server?
> >
> > > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher <
> bradpitc...@gmail.com
> > > >wrote:
> >
> > > > >>> Since I just spent much longer than it should have taken figuring
> > > this
> > > > >>> out, I will try and help you out.  I followed the instructions at
> the
> > > > >>> provided link and it sort of worked.  Not quite as well as I
> liked.
> > >  I
> > > > >>> used Apache for the progress reporting, which the author doesn't
> > > > >>> mention in the article but it is discussed here:
> >
> > >http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass.
> ..
> > > > >>> (it involves compiling and installing an apache module).
> > > > >>> The author also doesn't mention changes needed in settings.py:
> > > > >>> from django.conf import global_settings
> >
> > > > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', )
> +
> > > > >>> \<-- change path here
> > > > >>>global_settings.FILE_UPLOAD_HANDLERS
> >
> > > > >>> If you are using nginx or apache for the server side instead of
> > > > >>> django, you will need to modify progressUrl to point to whatever
> url
> > > > >>> you set up for accessing progress reports.
> >
> > > > >>> If you are looking for a demo, there is one linked in the article
> > > > >>> creecode posted.
> > > > >>> -Brad
> >
> > > > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > > > >>> > HI creecode,
> >
> > > > >>> > Can you share the project please? I can probably work on it and
> see
> > > > >>> what is
> > > > >>> > happening.
> > > > >>> > Till now, i havent even been able to get this working.
> >
> > > > >>> > -V
> >
> > > > >>> > On Sun, May 30, 2010 at 10:45 PM, creecode  >
> > > wrote:
> > > > >>> > > Hello V,
> >
> > > > >>> > > On May 29, 11:00 pm, Venkatraman S 
> wrote:
> >
> > > > >>> > > > I have been trying to build a simple file upload with
> progress
> > > bar.
> >
> > > > >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
> >
> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
> ..
> > > > >>> > > > will point you in the right direction.
> >
> > > > >>> > > I've experimented with a solution based tthe above but I
> wasn't
> > > > >>> > > entirely satisfied with my implementation.  I'm having a
> problem
> > > with
>

Re: File Upload with Progress Bar

2010-06-03 Thread patrickk
http://code.google.com/p/django-filebrowser/

cheers,
patrick

On 3 Jun., 16:10, Venkatraman S  wrote:
> Hi Patrick,
>
> Can you share a simple django app which uses Uploadify?  Did you use vanilla
> Uploadify or django-uploadify(github.com/tstone/django-uploadify*)*?
> I have been simply unable to make it run.  I also tried a django-uploadify,
> but no results! Frustrating it is.
>
> If you can share the code, i would rather use it along with some other
> experiments that I have been doing and publish it in the public domain.
>
> Regards.
>
> On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:
> > you could use uploadify, seehttp://www.uploadify.com/.
>
> > of course, it´s not an ideal solution since its flash-based.
> > we´ve been using uploadify with django and the filebrowser for about a
> > year now and it works quite well.
>
> > regards,
> > patrick
>
> > On 3 Jun., 06:32, Venkatraman S  wrote:
> > > Tell me about it! Its quite insane that there is no single-standard
> > solution
> > > for this.
> > > I have been hanging around in #django for sometime and there is still
> > > opposition to flash based solution. Also, i have not been to get it
> > working
> > > inspite of it being not an ideal solution.
> > > I hear that there are some issues with filebrowser since it uses
> > Uploadify.
> > > Also, i dont see any solution which works in both dev server and also in
> > the
> > > production using httpd/apache.
>
> > > Going insane! Let me know if you get anything working.
>
> > > PS: As i said, html5 is cool and works, but the client does not want to
> > use
> > > it!
>
> > > -V-http://twitter.com/venkasub
>
> > > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> > wrote:
> > > > Sort of, that's what the default is in the demo, but now I've noticed I
> > > > have the same problem with apache progress reporting as I did using
> > django
> > > > progress reporting.  It's behaving like it's not multi-threaded or
> > > > something.  It seems like I don't get any progress reports until the
> > file
> > > > has finished uploading.  It's actually driving me a bit crazy so I'm
> > going
> > > > to have to move on to something else for a while.
>
> > > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> > wrote:
>
> > > >> Does this work with the Django development server?
>
> > > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher  > >wrote:
>
> > > >>> Since I just spent much longer than it should have taken figuring
> > this
> > > >>> out, I will try and help you out.  I followed the instructions at the
> > > >>> provided link and it sort of worked.  Not quite as well as I liked.
> >  I
> > > >>> used Apache for the progress reporting, which the author doesn't
> > > >>> mention in the article but it is discussed here:
>
> >http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> > > >>> (it involves compiling and installing an apache module).
> > > >>> The author also doesn't mention changes needed in settings.py:
> > > >>> from django.conf import global_settings
>
> > > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> > > >>> \    <-- change path here
> > > >>>    global_settings.FILE_UPLOAD_HANDLERS
>
> > > >>> If you are using nginx or apache for the server side instead of
> > > >>> django, you will need to modify progressUrl to point to whatever url
> > > >>> you set up for accessing progress reports.
>
> > > >>> If you are looking for a demo, there is one linked in the article
> > > >>> creecode posted.
> > > >>> -Brad
>
> > > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > > >>> > HI creecode,
>
> > > >>> > Can you share the project please? I can probably work on it and see
> > > >>> what is
> > > >>> > happening.
> > > >>> > Till now, i havent even been able to get this working.
>
> > > >>> > -V
>
> > > >>> > On Sun, May 30, 2010 at 10:45 PM, creecode 
> > wrote:
> > > >>> > > Hello V,
>
> > > >>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> > > >>> > > > I have been trying to build a simple file upload with progress
> > bar.
>
> > > >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> > > >>> > > > will point you in the right direction.
>
> > > >>> > > I've experimented with a solution based tthe above but I wasn't
> > > >>> > > entirely satisfied with my implementation.  I'm having a problem
> > with
> > > >>> > > the progress bar not reaching 100% many times and some problems
> > with
> > > >>> > > the percentage complete number.
>
> > > >>> > > I've put my project on the back burner for now but if anyone has
> > any
> > > >>> > > examples they'd like to share I'd be interested in seeing them.
>
> > > >>> > > Toodle-looo...
> > > >>> > > creecode
>
> > > >>> > > --
> > > >>> > > You received this message because you are subscribed to the
> > Google
> > > >>> Groups
> > > >>> > > "Django users" group.
> > > >>> > > To post to this group, send email to

Re: File Upload with Progress Bar

2010-06-03 Thread Venkatraman S
Hi Patrick,

Can you share a simple django app which uses Uploadify?  Did you use vanilla
Uploadify or django-uploadify(github.com/tstone/django-uploadify*)*?
I have been simply unable to make it run.  I also tried a django-uploadify,
but no results! Frustrating it is.

If you can share the code, i would rather use it along with some other
experiments that I have been doing and publish it in the public domain.

Regards.

On Thu, Jun 3, 2010 at 5:39 PM, patrickk  wrote:

> you could use uploadify, see http://www.uploadify.com/.
>
> of course, it´s not an ideal solution since its flash-based.
> we´ve been using uploadify with django and the filebrowser for about a
> year now and it works quite well.
>
> regards,
> patrick
>
>
> On 3 Jun., 06:32, Venkatraman S  wrote:
> > Tell me about it! Its quite insane that there is no single-standard
> solution
> > for this.
> > I have been hanging around in #django for sometime and there is still
> > opposition to flash based solution. Also, i have not been to get it
> working
> > inspite of it being not an ideal solution.
> > I hear that there are some issues with filebrowser since it uses
> Uploadify.
> > Also, i dont see any solution which works in both dev server and also in
> the
> > production using httpd/apache.
> >
> > Going insane! Let me know if you get anything working.
> >
> > PS: As i said, html5 is cool and works, but the client does not want to
> use
> > it!
> >
> > -V-http://twitter.com/venkasub
> >
> > On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher 
> wrote:
> > > Sort of, that's what the default is in the demo, but now I've noticed I
> > > have the same problem with apache progress reporting as I did using
> django
> > > progress reporting.  It's behaving like it's not multi-threaded or
> > > something.  It seems like I don't get any progress reports until the
> file
> > > has finished uploading.  It's actually driving me a bit crazy so I'm
> going
> > > to have to move on to something else for a while.
> >
> > > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S 
> wrote:
> >
> > >> Does this work with the Django development server?
> >
> > >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher  >wrote:
> >
> > >>> Since I just spent much longer than it should have taken figuring
> this
> > >>> out, I will try and help you out.  I followed the instructions at the
> > >>> provided link and it sort of worked.  Not quite as well as I liked.
>  I
> > >>> used Apache for the progress reporting, which the author doesn't
> > >>> mention in the article but it is discussed here:
> >
> > >>>
> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> > >>> (it involves compiling and installing an apache module).
> > >>> The author also doesn't mention changes needed in settings.py:
> > >>> from django.conf import global_settings
> >
> > >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> > >>> \<-- change path here
> > >>>global_settings.FILE_UPLOAD_HANDLERS
> >
> > >>> If you are using nginx or apache for the server side instead of
> > >>> django, you will need to modify progressUrl to point to whatever url
> > >>> you set up for accessing progress reports.
> >
> > >>> If you are looking for a demo, there is one linked in the article
> > >>> creecode posted.
> > >>> -Brad
> >
> > >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> > >>> > HI creecode,
> >
> > >>> > Can you share the project please? I can probably work on it and see
> > >>> what is
> > >>> > happening.
> > >>> > Till now, i havent even been able to get this working.
> >
> > >>> > -V
> >
> > >>> > On Sun, May 30, 2010 at 10:45 PM, creecode 
> wrote:
> > >>> > > Hello V,
> >
> > >>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
> >
> > >>> > > > I have been trying to build a simple file upload with progress
> bar.
> >
> > >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
> >
> > >>>
> http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> > >>> > > > will point you in the right direction.
> >
> > >>> > > I've experimented with a solution based tthe above but I wasn't
> > >>> > > entirely satisfied with my implementation.  I'm having a problem
> with
> > >>> > > the progress bar not reaching 100% many times and some problems
> with
> > >>> > > the percentage complete number.
> >
> > >>> > > I've put my project on the back burner for now but if anyone has
> any
> > >>> > > examples they'd like to share I'd be interested in seeing them.
> >
> > >>> > > Toodle-looo...
> > >>> > > creecode
> >
> > >>> > > --
> > >>> > > You received this message because you are subscribed to the
> Google
> > >>> Groups
> > >>> > > "Django users" group.
> > >>> > > To post to this group, send email to
> django-us...@googlegroups.com.
> > >>> > > To unsubscribe from this group, send email to
> > >>> > > django-users+unsubscr...@googlegroups.com
> 
> >
> > >>> 
> 
> >
> >
> > >>> > > .
> > >>> > > For more options, visit this group at
> > >

Re: File Upload with Progress Bar

2010-06-03 Thread patrickk
you could use uploadify, see http://www.uploadify.com/.

of course, it´s not an ideal solution since its flash-based.
we´ve been using uploadify with django and the filebrowser for about a
year now and it works quite well.

regards,
patrick


On 3 Jun., 06:32, Venkatraman S  wrote:
> Tell me about it! Its quite insane that there is no single-standard solution
> for this.
> I have been hanging around in #django for sometime and there is still
> opposition to flash based solution. Also, i have not been to get it working
> inspite of it being not an ideal solution.
> I hear that there are some issues with filebrowser since it uses Uploadify.
> Also, i dont see any solution which works in both dev server and also in the
> production using httpd/apache.
>
> Going insane! Let me know if you get anything working.
>
> PS: As i said, html5 is cool and works, but the client does not want to use
> it!
>
> -V-http://twitter.com/venkasub
>
> On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher  wrote:
> > Sort of, that's what the default is in the demo, but now I've noticed I
> > have the same problem with apache progress reporting as I did using django
> > progress reporting.  It's behaving like it's not multi-threaded or
> > something.  It seems like I don't get any progress reports until the file
> > has finished uploading.  It's actually driving me a bit crazy so I'm going
> > to have to move on to something else for a while.
>
> > On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:
>
> >> Does this work with the Django development server?
>
> >> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>
> >>> Since I just spent much longer than it should have taken figuring this
> >>> out, I will try and help you out.  I followed the instructions at the
> >>> provided link and it sort of worked.  Not quite as well as I liked.  I
> >>> used Apache for the progress reporting, which the author doesn't
> >>> mention in the article but it is discussed here:
>
> >>>http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_pass...
> >>> (it involves compiling and installing an apache module).
> >>> The author also doesn't mention changes needed in settings.py:
> >>> from django.conf import global_settings
>
> >>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> >>> \    <-- change path here
> >>>    global_settings.FILE_UPLOAD_HANDLERS
>
> >>> If you are using nginx or apache for the server side instead of
> >>> django, you will need to modify progressUrl to point to whatever url
> >>> you set up for accessing progress reports.
>
> >>> If you are looking for a demo, there is one linked in the article
> >>> creecode posted.
> >>> -Brad
>
> >>> On May 30, 12:23 pm, Venkatraman S  wrote:
> >>> > HI creecode,
>
> >>> > Can you share the project please? I can probably work on it and see
> >>> what is
> >>> > happening.
> >>> > Till now, i havent even been able to get this working.
>
> >>> > -V
>
> >>> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> >>> > > Hello V,
>
> >>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> >>> > > > I have been trying to build a simple file upload with progress bar.
>
> >>> > > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >>>http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> >>> > > > will point you in the right direction.
>
> >>> > > I've experimented with a solution based tthe above but I wasn't
> >>> > > entirely satisfied with my implementation.  I'm having a problem with
> >>> > > the progress bar not reaching 100% many times and some problems with
> >>> > > the percentage complete number.
>
> >>> > > I've put my project on the back burner for now but if anyone has any
> >>> > > examples they'd like to share I'd be interested in seeing them.
>
> >>> > > Toodle-looo...
> >>> > > creecode
>
> >>> > > --
> >>> > > You received this message because you are subscribed to the Google
> >>> Groups
> >>> > > "Django users" group.
> >>> > > To post to this group, send email to django-us...@googlegroups.com.
> >>> > > To unsubscribe from this group, send email to
> >>> > > django-users+unsubscr...@googlegroups.com
> >>> 
>
> >>> > > .
> >>> > > For more options, visit this group at
> >>> > >http://groups.google.com/group/django-users?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Django users" group.
> >>> To post to this group, send email to django-us...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> django-users+unsubscr...@googlegroups.com
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/django-users?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Django users" group.
> >> To post to this group, send email to django-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com
> >

Re: File Upload with Progress Bar

2010-06-02 Thread Venkatraman S
Tell me about it! Its quite insane that there is no single-standard solution
for this.
I have been hanging around in #django for sometime and there is still
opposition to flash based solution. Also, i have not been to get it working
inspite of it being not an ideal solution.
I hear that there are some issues with filebrowser since it uses Uploadify.
Also, i dont see any solution which works in both dev server and also in the
production using httpd/apache.

Going insane! Let me know if you get anything working.

PS: As i said, html5 is cool and works, but the client does not want to use
it!

-V-
http://twitter.com/venkasub


On Thu, Jun 3, 2010 at 9:54 AM, Brad Pitcher  wrote:

> Sort of, that's what the default is in the demo, but now I've noticed I
> have the same problem with apache progress reporting as I did using django
> progress reporting.  It's behaving like it's not multi-threaded or
> something.  It seems like I don't get any progress reports until the file
> has finished uploading.  It's actually driving me a bit crazy so I'm going
> to have to move on to something else for a while.
>
> On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:
>
>> Does this work with the Django development server?
>>
>>
>> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>>
>>> Since I just spent much longer than it should have taken figuring this
>>> out, I will try and help you out.  I followed the instructions at the
>>> provided link and it sort of worked.  Not quite as well as I liked.  I
>>> used Apache for the progress reporting, which the author doesn't
>>> mention in the article but it is discussed here:
>>>
>>> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/
>>> (it involves compiling and installing an apache module).
>>> The author also doesn't mention changes needed in settings.py:
>>> from django.conf import global_settings
>>>
>>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
>>> \<-- change path here
>>>global_settings.FILE_UPLOAD_HANDLERS
>>>
>>> If you are using nginx or apache for the server side instead of
>>> django, you will need to modify progressUrl to point to whatever url
>>> you set up for accessing progress reports.
>>>
>>> If you are looking for a demo, there is one linked in the article
>>> creecode posted.
>>> -Brad
>>>
>>> On May 30, 12:23 pm, Venkatraman S  wrote:
>>> > HI creecode,
>>> >
>>> > Can you share the project please? I can probably work on it and see
>>> what is
>>> > happening.
>>> > Till now, i havent even been able to get this working.
>>> >
>>> > -V
>>> >
>>> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
>>> > > Hello V,
>>> >
>>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>>> >
>>> > > > I have been trying to build a simple file upload with progress bar.
>>> >
>>> > > AFAIK there isn't a simple solution.  Perhaps this info <
>>> >
>>> > >
>>> http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
>>> > > > will point you in the right direction.
>>> >
>>> > > I've experimented with a solution based tthe above but I wasn't
>>> > > entirely satisfied with my implementation.  I'm having a problem with
>>> > > the progress bar not reaching 100% many times and some problems with
>>> > > the percentage complete number.
>>> >
>>> > > I've put my project on the back burner for now but if anyone has any
>>> > > examples they'd like to share I'd be interested in seeing them.
>>> >
>>> > > Toodle-looo...
>>> > > creecode
>>> >
>>> > > --
>>> > > You received this message because you are subscribed to the Google
>>> Groups
>>> > > "Django users" group.
>>> > > To post to this group, send email to django-us...@googlegroups.com.
>>> > > To unsubscribe from this group, send email to
>>> > > django-users+unsubscr...@googlegroups.com
>>> 
>>> >
>>> > > .
>>> > > For more options, visit this group at
>>> > >http://groups.google.com/group/django-users?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroup

Re: File Upload with Progress Bar

2010-06-02 Thread Brad Pitcher
Sort of, that's what the default is in the demo, but now I've noticed I have
the same problem with apache progress reporting as I did using django
progress reporting.  It's behaving like it's not multi-threaded or
something.  It seems like I don't get any progress reports until the file
has finished uploading.  It's actually driving me a bit crazy so I'm going
to have to move on to something else for a while.

On Wed, Jun 2, 2010 at 9:16 PM, Venkatraman S  wrote:

> Does this work with the Django development server?
>
>
> On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher wrote:
>
>> Since I just spent much longer than it should have taken figuring this
>> out, I will try and help you out.  I followed the instructions at the
>> provided link and it sort of worked.  Not quite as well as I liked.  I
>> used Apache for the progress reporting, which the author doesn't
>> mention in the article but it is discussed here:
>>
>> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/
>> (it involves compiling and installing an apache module).
>> The author also doesn't mention changes needed in settings.py:
>> from django.conf import global_settings
>>
>> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
>> \<-- change path here
>>global_settings.FILE_UPLOAD_HANDLERS
>>
>> If you are using nginx or apache for the server side instead of
>> django, you will need to modify progressUrl to point to whatever url
>> you set up for accessing progress reports.
>>
>> If you are looking for a demo, there is one linked in the article
>> creecode posted.
>> -Brad
>>
>> On May 30, 12:23 pm, Venkatraman S  wrote:
>> > HI creecode,
>> >
>> > Can you share the project please? I can probably work on it and see what
>> is
>> > happening.
>> > Till now, i havent even been able to get this working.
>> >
>> > -V
>> >
>> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
>> > > Hello V,
>> >
>> > > On May 29, 11:00 pm, Venkatraman S  wrote:
>> >
>> > > > I have been trying to build a simple file upload with progress bar.
>> >
>> > > AFAIK there isn't a simple solution.  Perhaps this info <
>> >
>> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
>> ..
>> > > > will point you in the right direction.
>> >
>> > > I've experimented with a solution based tthe above but I wasn't
>> > > entirely satisfied with my implementation.  I'm having a problem with
>> > > the progress bar not reaching 100% many times and some problems with
>> > > the percentage complete number.
>> >
>> > > I've put my project on the back burner for now but if anyone has any
>> > > examples they'd like to share I'd be interested in seeing them.
>> >
>> > > Toodle-looo...
>> > > creecode
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> Groups
>> > > "Django users" group.
>> > > To post to this group, send email to django-us...@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > > django-users+unsubscr...@googlegroups.com
>> 
>> >
>> > > .
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-02 Thread Venkatraman S
 Does this work with the Django development server?

On Thu, Jun 3, 2010 at 8:13 AM, Brad Pitcher  wrote:

> Since I just spent much longer than it should have taken figuring this
> out, I will try and help you out.  I followed the instructions at the
> provided link and it sort of worked.  Not quite as well as I liked.  I
> used Apache for the progress reporting, which the author doesn't
> mention in the article but it is discussed here:
>
> http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/
> (it involves compiling and installing an apache module).
> The author also doesn't mention changes needed in settings.py:
> from django.conf import global_settings
>
> FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
> \<-- change path here
>global_settings.FILE_UPLOAD_HANDLERS
>
> If you are using nginx or apache for the server side instead of
> django, you will need to modify progressUrl to point to whatever url
> you set up for accessing progress reports.
>
> If you are looking for a demo, there is one linked in the article
> creecode posted.
> -Brad
>
> On May 30, 12:23 pm, Venkatraman S  wrote:
> > HI creecode,
> >
> > Can you share the project please? I can probably work on it and see what
> is
> > happening.
> > Till now, i havent even been able to get this working.
> >
> > -V
> >
> > On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> > > Hello V,
> >
> > > On May 29, 11:00 pm, Venkatraman S  wrote:
> >
> > > > I have been trying to build a simple file upload with progress bar.
> >
> > > AFAIK there isn't a simple solution.  Perhaps this info <
> >
> > >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress.
> ..
> > > > will point you in the right direction.
> >
> > > I've experimented with a solution based tthe above but I wasn't
> > > entirely satisfied with my implementation.  I'm having a problem with
> > > the progress bar not reaching 100% many times and some problems with
> > > the percentage complete number.
> >
> > > I've put my project on the back burner for now but if anyone has any
> > > examples they'd like to share I'd be interested in seeing them.
> >
> > > Toodle-looo...
> > > creecode
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com
> 
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-06-02 Thread Brad Pitcher
Since I just spent much longer than it should have taken figuring this
out, I will try and help you out.  I followed the instructions at the
provided link and it sort of worked.  Not quite as well as I liked.  I
used Apache for the progress reporting, which the author doesn't
mention in the article but it is discussed here:
http://piotrsarnacki.com/2008/06/18/upload-progress-bar-with-mod_passenger-and-apache/
(it involves compiling and installing an apache module).
The author also doesn't mention changes needed in settings.py:
from django.conf import global_settings

FILE_UPLOAD_HANDLERS = ('path.to.UploadProgressCachedHandler', ) +
\<-- change path here
global_settings.FILE_UPLOAD_HANDLERS

If you are using nginx or apache for the server side instead of
django, you will need to modify progressUrl to point to whatever url
you set up for accessing progress reports.

If you are looking for a demo, there is one linked in the article
creecode posted.
-Brad

On May 30, 12:23 pm, Venkatraman S  wrote:
> HI creecode,
>
> Can you share the project please? I can probably work on it and see what is
> happening.
> Till now, i havent even been able to get this working.
>
> -V
>
> On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:
> > Hello V,
>
> > On May 29, 11:00 pm, Venkatraman S  wrote:
>
> > > I have been trying to build a simple file upload with progress bar.
>
> > AFAIK there isn't a simple solution.  Perhaps this info <
>
> >http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress...
> > > will point you in the right direction.
>
> > I've experimented with a solution based tthe above but I wasn't
> > entirely satisfied with my implementation.  I'm having a problem with
> > the progress bar not reaching 100% many times and some problems with
> > the percentage complete number.
>
> > I've put my project on the back burner for now but if anyone has any
> > examples they'd like to share I'd be interested in seeing them.
>
> > Toodle-looo...
> > creecode
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-05-30 Thread creecode
Hello V,

On May 30, 12:23 pm, Venkatraman S  wrote:

> Can you share the project please?

My progress bar code is integrated into a larger application which I'm
unable to share at this time.  I've put the progress bar feature on
the back burner and unfortunately I don't have spare time to go in and
pull out the progress bar related code.

> Till now, i haven't even been able to get this working.

Essentially my code is not far off from what is at the link I
provided.  Is your code based on the code at the link I provided?  We
might be able to point you in the right direction if you give us more
detail about what isn't working.

Toodle-looo...
creecode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-05-30 Thread Venkatraman S
HI creecode,

Can you share the project please? I can probably work on it and see what is
happening.
Till now, i havent even been able to get this working.

-V

On Sun, May 30, 2010 at 10:45 PM, creecode  wrote:

> Hello V,
>
> On May 29, 11:00 pm, Venkatraman S  wrote:
>
> > I have been trying to build a simple file upload with progress bar.
>
> AFAIK there isn't a simple solution.  Perhaps this info <
>
> http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress-bars-jquery-django-nginx/
> > will point you in the right direction.
>
> I've experimented with a solution based tthe above but I wasn't
> entirely satisfied with my implementation.  I'm having a problem with
> the progress bar not reaching 100% many times and some problems with
> the percentage complete number.
>
> I've put my project on the back burner for now but if anyone has any
> examples they'd like to share I'd be interested in seeing them.
>
> Toodle-looo...
> creecode
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: File Upload with Progress Bar

2010-05-30 Thread creecode
Hello V,

On May 29, 11:00 pm, Venkatraman S  wrote:

> I have been trying to build a simple file upload with progress bar.

AFAIK there isn't a simple solution.  Perhaps this info <
http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress-bars-jquery-django-nginx/
> will point you in the right direction.

I've experimented with a solution based tthe above but I wasn't
entirely satisfied with my implementation.  I'm having a problem with
the progress bar not reaching 100% many times and some problems with
the percentage complete number.

I've put my project on the back burner for now but if anyone has any
examples they'd like to share I'd be interested in seeing them.

Toodle-looo...
creecode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: file upload formset

2010-04-17 Thread Karen Tracey
On Sat, Apr 17, 2010 at 2:54 AM, Alfredo Alessandrini
wrote:

> profile.html
> ---
> 
> {{ formset }}
> 
> 
> ---
>
> If I change 'course' or 'project' it's work. But if I try to upload a
> file don't work.  Any suggestion?
>
>
First problem (might be last problem also, I did not look at all at the rest
of the code) is the HTML form is not specified to have an enctype of
multipart/form-data.  From
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#basic-file-uploads
:

Note that request.FILES will only contain data if the request method was
POST and the  that posted the request has the attribute
enctype="multipart/form-data". Otherwise, request.FILES will be empty.

Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[solved]Re: file upload issue

2009-07-29 Thread Salvatore Leone

Again I found the answer...

I forgot to put enctype="multipart/form-data" in  my form... sorry for 
disturbing you.

-S

Salvatore Leone ha scritto:
> Hello again,
>
> I know this is probably an already discussed question, but I can't get 
> out of this. I've got a form which may or may not send a file, here is 
> the snippet of my view function:
>
>
> if request.method == POST:
>   #process the form
>   ...
>  
>   if request.FILES:   
> attached_file = request.FILES['attached_file']   
> attach = Attach() # my model holding the file
> attach.file(attached_file)
> attach.save()
>
>
> and here is my model for attachs:
>
>
> class Attach(models.Model):
>   attached_file = models.FileField(upload_to='file_risposte')
>   risposta = models.ForeignKey(Risposte)
>
>
> the problem is that *never* saves an attach.
>
> any idea?
>
> -Salvatore
>
>
>
> >
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: file upload issue

2009-07-29 Thread cootetom

Use a modal form for this which includes a file field that has
required set to false.

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-forms-modelforms
http://docs.djangoproject.com/en/dev/ref/forms/fields/#filefield

Easier to let django handle the request then figure it all out
manually.



On Jul 29, 4:29 pm, Salvatore Leone 
wrote:
> Hello again,
>
> I know this is probably an already discussed question, but I can't get
> out of this. I've got a form which may or may not send a file, here is
> the snippet of my view function:
>
> if request.method == POST:
>   #process the form
>   ...
>
>   if request.FILES:                  
>         attached_file = request.FILES['attached_file']      
>         attach = Attach() # my model holding the file
>         attach.file(attached_file)
>         attach.save()
>
> and here is my model for attachs:
>
> class Attach(models.Model):
>   attached_file = models.FileField(upload_to='file_risposte')
>   risposta = models.ForeignKey(Risposte)
>
> the problem is that *never* saves an attach.
>
> any idea?
>
> -Salvatore    
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File Upload : Memory consumption

2009-07-17 Thread Alvin

has anyone had luck getting past this?

I am using a recent 1.1 beta release have checked the folder
permissions and set the FILE_UPLOAD_TEMP_DIR all 777

code is at http://pastebin.com/m4332fdb2

On Jun 24, 2:06 pm, alecs  wrote:
> If to be honest I can't google this posts ... Most of the links are
> for patches or for old django versions :(
> Don't know, maybe I should try to setFILE_UPLOAD_MAX_MEMORY_SIZE, but
> I didn't change it , so the default value is 2.5Mb ...
>
> On Jun 24, 2:54 pm, John M  wrote:
>
>
>
> > I've seen quite a few posts on this, and I think it's documented as
> > well.
>
> > As I recall, there is a certain way of doing large uploads, search the
> > docs and the forum and I'm sure you'll find it.
>
> > On Jun 24, 3:20 am, alecs  wrote:
>
> > > Hi! I'm trying to upload a large file (700Mb) and something wrong with
> > > django happens: First it starts caching enormously (4Gb of ram are
> > > used), than it starts to purge caches and starts swapping (1Gb of swap
> > > is used).
> > > Have you ever faced with such a thing ? Django 1.02, mod_wsgi + Apache
> > > 2.2
> > > Thanks :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File Upload : Memory consumption

2009-06-24 Thread alecs

If to be honest I can't google this posts ... Most of the links are
for patches or for old django versions :(
Don't know, maybe I should try to set FILE_UPLOAD_MAX_MEMORY_SIZE, but
I didn't change it , so the default value is 2.5Mb ...

On Jun 24, 2:54 pm, John M  wrote:
> I've seen quite a few posts on this, and I think it's documented as
> well.
>
> As I recall, there is a certain way of doing large uploads, search the
> docs and the forum and I'm sure you'll find it.
>
> On Jun 24, 3:20 am, alecs  wrote:
>
> > Hi! I'm trying to upload a large file (700Mb) and something wrong with
> > django happens: First it starts caching enormously (4Gb of ram are
> > used), than it starts to purge caches and starts swapping (1Gb of swap
> > is used).
> > Have you ever faced with such a thing ? Django 1.02, mod_wsgi + Apache
> > 2.2
> > Thanks :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File Upload : Memory consumption

2009-06-24 Thread alecs

The maximum size, in bytes, for files that will be uploaded into
memory. Files larger than FILE_UPLOAD_MAX_MEMORY_SIZE will be streamed
to disk.
Defaults to 2.5 megabytes.

My file size is greater than 2.5Mb, so it will be streamed to disk...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File Upload : Memory consumption

2009-06-24 Thread Xavier Ordoquy

On Wed, 2009-06-24 at 03:20 -0700, alecs wrote:
> Hi! I'm trying to upload a large file (700Mb) and something wrong with
> django happens: First it starts caching enormously (4Gb of ram are
> used), than it starts to purge caches and starts swapping (1Gb of swap
> is used).
> Have you ever faced with such a thing ? Django 1.02, mod_wsgi + Apache
> 2.2
> Thanks :)

Hi, have you tried to set FILE_UPLOAD_MAX_MEMORY_SIZE ?
There are a couple if tips there too:
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/

Hopes this will help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File Upload : Memory consumption

2009-06-24 Thread John M

I've seen quite a few posts on this, and I think it's documented as
well.

As I recall, there is a certain way of doing large uploads, search the
docs and the forum and I'm sure you'll find it.

On Jun 24, 3:20 am, alecs  wrote:
> Hi! I'm trying to upload a large file (700Mb) and something wrong with
> django happens: First it starts caching enormously (4Gb of ram are
> used), than it starts to purge caches and starts swapping (1Gb of swap
> is used).
> Have you ever faced with such a thing ? Django 1.02, mod_wsgi + Apache
> 2.2
> Thanks :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: file upload docs obsolete?

2009-05-14 Thread msoulier

On May 14, 3:51 pm, msoulier  wrote:
> I looked here
>
> http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
>
> and it mentions request.FILES being a dictionary, but the 1.0 porting
> guide here
>
> http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide/
>
> says otherwise.
>
> Was this overlooked? I think the page needs an update.

Oh, I misread. FILES is still a dictionary, but it no longer returns
dictionaries, but UploadedFile objects.

Gotcha.

Is it Friday yet?

Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-29 Thread Torsten Bronger

Hallöchen!

Torsten Bronger writes:

> I'd like to ensure that people only upload PDF files, so the file
> must start with "%PDF".  If the file starts with something else,
> the form must not validate.
>
> How do I do that?  I though about a clean_... method which reads
> the start of the file and then re-opens it.  Is this a good idea?

At least this works.  A look at the source code revealed that every
UploadedFile object must have an open() method, so re-opening it
should be safe, no matter which storage system or uploaded file type
is in use.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-29 Thread Torsten Bronger

Hallöchen!

P M writes:

> yes you can, because signature of pdf is in the starting of 1st
> chunk of stream... rest of the things are of hardly interest for
> libmagic identification...

Again, this is not the point.  The point is whether I can safely
read the first bytes and put them back into the stream (or, in other
words, do a seek(0)).  If the file was sent into a file in /tmp/,
this may work, but my question is whether this approach is
compatible with all upload handlers.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-28 Thread P M
yes you can, because signature of pdf is in the starting of 1st chunk of
stream... rest of the things are of hardly interest for libmagic
identification...

what ever method you are using to handle the chunks/streams is still the
same, regardless of type of data user is uploading,

one more tip :) libmagic python interface also provide a option to you to
feed in stream/part of chunk... so hack that simple interface and you are
done ;)

greetings,
Puneet


On Sat, Mar 28, 2009 at 10:37 PM, Torsten Bronger <
bron...@physik.rwth-aachen.de> wrote:

>
> Hallöchen!
>
> P M writes:
>
> > there are various ways to check, but best will be to use
> > Python-libmagic interface... it did worked well for me ..
>
> Thank for the hint, however, the interesting part is whether I can
> safely tamper with the file object in the clean method, so that the
> actual download with .chunks() afterwards still works correctly.
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-28 Thread Torsten Bronger

Hallöchen!

P M writes:

> there are various ways to check, but best will be to use
> Python-libmagic interface... it did worked well for me ..

Thank for the hint, however, the interesting part is whether I can
safely tamper with the file object in the clean method, so that the
actual download with .chunks() afterwards still works correctly.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload: how to validate file type

2009-03-28 Thread P M
servus,

there are various ways to check, but best will be to use Python-libmagic
interface... it did worked well for me ..

mit freundliche Grüß

On Sat, Mar 28, 2009 at 10:16 PM, Torsten Bronger <
bron...@physik.rwth-aachen.de> wrote:

>
> Hallöchen!
>
> I'd like to ensure that people only upload PDF files, so the file
> must start with "%PDF".  If the file starts with something else, the
> form must not validate.
>
> How do I do that?  I though about a clean_... method which reads the
> start of the file and then re-opens it.  Is this a good idea?
>
> Tschö,
> Torsten.
>
> --
> Torsten Bronger, aquisgrana, europa vetus
>   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
>
>
> >
>


-- 
If you spin an oriental man, does he become disoriented?
(-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu

is der net süß » ε(●̮̮̃•̃)з
-PM

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-06 Thread Graham Dumpleton



On Jan 6, 10:31 pm, ppdo  wrote:
> To Karen: yes, I meant TCP RST, sorry.
>
> Update:
>
> Using mod_wsgi made the problem go away for Firefox.
>
> Limiting my research to an interaction problem between Apache and
> Safari, I stumbled upon this bug report for Apache
> https://bugs.webkit.org/show_bug.cgi?id=5760 that describes something
> very similar to what is happening and it is apparently still open.

For which the problem was identified as being in MacOSX Foundation
framework. Supposedly fixed in 10.5.5, but some people still having
problems after updating to that revision of OS.

Thanks for finding that page in webkit issue tracker, will be good one
to keep in mind id others see similar problem. I'll have to see if
disabling keep alive solves my ab performance tests.

Graham

> Reading this gave me the idea to try and disable the keepalive and,
> though I need to test it more extensively, it seems the problem is
> gone.
>
> A simple:
>
> BrowserMatch "Safari" nokeepalive
>
> in the Apache configuration did the trick. As on the production server
> this application will not have to stand much traffic anyway, it should
> be ok also without keepalive.
>
> I'll update this thread if I have more findings.
>
> Thank you both for your ideas!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-06 Thread ppdo

To Karen: yes, I meant TCP RST, sorry.

Update:

Using mod_wsgi made the problem go away for Firefox.

Limiting my research to an interaction problem between Apache and
Safari, I stumbled upon this bug report for Apache
https://bugs.webkit.org/show_bug.cgi?id=5760 that describes something
very similar to what is happening and it is apparently still open.
Reading this gave me the idea to try and disable the keepalive and,
though I need to test it more extensively, it seems the problem is
gone.

A simple:

BrowserMatch "Safari" nokeepalive

in the Apache configuration did the trick. As on the production server
this application will not have to stand much traffic anyway, it should
be ok also without keepalive.

I'll update this thread if I have more findings.

Thank you both for your ideas!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-05 Thread Karen Tracey
On Mon, Jan 5, 2009 at 5:30 PM, ppdo  wrote:

>
> I tried to monitor the interface using WireShark and the communication
> just hangs during a data transfer: Apache is just acknowledging the
> receipt of some packets and then just seems to hang. The suspicious
> bit is a fairly long series of http RST about 20ms before the server
> hangs. Though I'm not knowledgeable enough on http, to me this clearly
> points in the direction of an Apache problem, though I'm not sure if
> and how it can be solved.
>

I don't know what an http RST is.  Do you mean TCP RST?  You see a long
series of TCP resets?  That would indicate a problem.  Which machine sends
them?  If you put a formatted trace somewhere I could see it I might be able
to do some diagnosis, but it sounds like you may have a pretty low-level
network problem going on.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-05 Thread Graham Dumpleton



On Jan 6, 9:30 am, ppdo  wrote:
> I tried to monitor the interface using WireShark and the communication
> just hangs during a data transfer: Apache is just acknowledging the
> receipt of some packets and then just seems to hang. The suspicious
> bit is a fairly long series of http RST about 20ms before the server
> hangs. Though I'm not knowledgeable enough on http, to me this clearly
> points in the direction of an Apache problem, though I'm not sure if
> and how it can be solved.
>
> I will try the following:
> 1. Check whether there is a known problem in my version of Apache
> (it's the Leopard standard version, so it might be old enough)
> 2. Reconfigure/recompile the server, to make it work in 32-bit mode
>
> Any idea additional is welcome, of course!

AFAIK Apache itself wouldn't be generating those packets directly. It
just uses a socket and the standard operating system network library
socket functions. If there is an issue with packets at the TCP/IP
level, it would be an operating system level issue.

FWIW, when I am doing benchmarking on MacOSX I often see 'ab' stall
when trying to do even moderate size test runs of 1 requests. I
have never bothered to go into it enough detail to work out the cause,
although for that case also don't believe it was Apache. If anything
was blaming 'ab', but wouldn't be surprised if it was a network level
issue, even though I was doing it against server on same box.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-05 Thread ppdo

I tried to monitor the interface using WireShark and the communication
just hangs during a data transfer: Apache is just acknowledging the
receipt of some packets and then just seems to hang. The suspicious
bit is a fairly long series of http RST about 20ms before the server
hangs. Though I'm not knowledgeable enough on http, to me this clearly
points in the direction of an Apache problem, though I'm not sure if
and how it can be solved.

I will try the following:
1. Check whether there is a known problem in my version of Apache
(it's the Leopard standard version, so it might be old enough)
2. Reconfigure/recompile the server, to make it work in 32-bit mode

Any idea additional is welcome, of course!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-05 Thread Graham Dumpleton



On Jan 5, 8:33 pm, ppdo  wrote:
> The failure does not depend on the file size: I manage to upload files
> bigger than 60 MB and fail on 30 kB files.
>
> I tried with Safari and Firefox and I got the same results, though I
> got the *impression* (but given the randomness of the problem I am not
> sure this is a real observation) that it fails more often if I use the
> client on the same machine as the server and less if the client runs
> from a different machine. Both client and server were all OSX/Leopard.
>
> In the Apache configuration there is no explicit timeout directive.
> However, when the problem occurs the client hangs for a very long time
> before reporting the error: from the server logs it takes about 5
> minutes. When it succeeds the operation completes within a few
> seconds, depending on the size of the file.

The default for Timeout if not set is 300 seconds (5 minutes).

>From Apache documentation:

"""The TimeOut directive currently defines the amount of time Apache
will wait for three things:

The total amount of time it takes to receive a GET request.
The amount of time between receipt of TCP packets on a POST or PUT
request.
The amount of time between ACKs on transmissions of TCP packets in
responses."""

The timeout is significant here as the error in logs for mod_wsgi
(which is more informative than mod_python and why I asked about it)
was:

[Mon Jan 05 08:13:06 2009] [error] [client 127.0.0.1] (70007)The
timeout specified has expired: mod_wsgi (pid=46687): Unable to get
bucket brigade for request., referer: http://127.0.0.1/myapp/upload/2009-01-03/1

So, what would appear to be happening is that at the client socket
itself where Apache is applying this timeout, one of those three
events is occurring.

The first actually probably applies to POST request as well. What it
actually means is how long it takes to read the headers of HTTP
request. If the client is very slow providing the full headers it
would timeout. It can't be that in this case though as the higher
mod_wsgi code would never have been called in the first place if the
full request headers hadn't been read.

The others are more serious lower level socket network issues.

I can't think of any other reason that this timeout would be triggered
within Apache at a higher level than the client socket.

All I can probably suggest at this point is use tcpdump to monitor the
traffic to port 80 for some of these requests and see if you can
capture what is occurring at network layer for socket when it hangs.
>From that might at least confirm if data is getting to Apache. If you
know enough about networking, maybe you can tell if all the correct
protocol level messages for TCP are there.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-05 Thread ppdo

The failure does not depend on the file size: I manage to upload files
bigger than 60 MB and fail on 30 kB files.

I tried with Safari and Firefox and I got the same results, though I
got the *impression* (but given the randomness of the problem I am not
sure this is a real observation) that it fails more often if I use the
client on the same machine as the server and less if the client runs
from a different machine. Both client and server were all OSX/Leopard.

In the Apache configuration there is no explicit timeout directive.
However, when the problem occurs the client hangs for a very long time
before reporting the error: from the server logs it takes about 5
minutes. When it succeeds the operation completes within a few
seconds, depending on the size of the file.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload failing occasionally

2009-01-05 Thread Graham Dumpleton

Sorry, some more questions.

How big are the files you are trying to upload?

What browser/client are you using to do the uploads?

What do you have Timeout directive set to in Apache configuration?

Graham

On Jan 5, 6:24 pm, ppdo  wrote:
> Hi,
>
> Thanks for looking into this. I used embedded mode and the error is
> the following (different message, but same place in
> multipartparser.py):
>
> IOError at /myapp/upload/2009-01-03/1
> request data read error
> Request Method: POST
> Request URL:    http://127.0.0.1/myapp/upload/2009-01-03/1
> Exception Type: IOError
> Exception Value:
> request data read error
> Exception Location:     /Library/Frameworks/Python64.framework/Versions/
> 2.6/lib/python2.6/site-packages/django/http/multipartparser.py in
> read, line 406
> Python Executable:      /usr/sbin/httpd
> Python Version: 2.6.1
> Python Path:    ['/djangoapps/', '/Library/Frameworks/Python64.framework/
> Versions/2.6/lib/python26.zip', '/Library/Frameworks/
> Python64.framework/Versions/2.6/lib/python2.6', '/Library/Frameworks/
> Python64.framework/Versions/2.6/lib/python2.6/plat-darwin', '/Library/
> Frameworks/Python64.framework/Versions/2.6/lib/python2.6/plat-mac', '/
> Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/plat-
> mac/lib-scriptpackages', '/Library/Frameworks/Python64.framework/
> Versions/2.6/lib/python2.6/lib-tk', '/Library/Frameworks/
> Python64.framework/Versions/2.6/lib/python2.6/lib-old', '/Library/
> Frameworks/Python64.framework/Versions/2.6/lib/python2.6/lib-dynload',
> '/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/
> site-packages']
> Server time:    Mon, 5 Jan 2009 08:20:20 +0100
>
> Environment:
>
> Request Method: POST
> Request URL:http://127.0.0.1/myapp/upload/2009-01-03/1
> Django Version: 1.0.2 final
> Python Version: 2.6.1
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'systemic.peergroup']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
> Traceback:
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/core/handlers/base.py" in get_response
>   86.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "/djangoapps/myapp/../myapp/application1/views.py" in upload_file
>   137.         form = UploadFileForm(request.POST, request.FILES)
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/core/handlers/wsgi.py" in _get_post
>   169.             self._load_post_and_files()
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/core/handlers/wsgi.py" in
> _load_post_and_files
>   135.                     self._post, self._files =
> self.parse_file_upload(self.META, self.environ['wsgi.input'])
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/__init__.py" in parse_file_upload
>   124.         return parser.parse()
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in parse
>   134.             for item_type, meta_data, field_stream in Parser
> (stream, self._boundary):
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in __iter__
>   607.         for sub_stream in boundarystream:
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in next
>   421.             return LazyStream(BoundaryIter(self._stream,
> self._boundary))
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in __init__
>   447.         unused_char = self._stream.read(1)
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in read
>   300.         out = ''.join(parts())
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in parts
>   293.                 chunk = self.next()
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in next
>   315.             output = self._producer.next()
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in next
>   376.             data = self.flo.read(self.chunk_size)
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in read
>   406.         return self._file.read(num_bytes)
>
> Exception Type: IOError at /myapp/upload/2009-01-

Re: File upload failing occasionally

2009-01-04 Thread ppdo

Hi,

Thanks for looking into this. I used embedded mode and the error is
the following (different message, but same place in
multipartparser.py):

IOError at /myapp/upload/2009-01-03/1
request data read error
Request Method: POST
Request URL:http://127.0.0.1/myapp/upload/2009-01-03/1
Exception Type: IOError
Exception Value:
request data read error
Exception Location: /Library/Frameworks/Python64.framework/Versions/
2.6/lib/python2.6/site-packages/django/http/multipartparser.py in
read, line 406
Python Executable:  /usr/sbin/httpd
Python Version: 2.6.1
Python Path:['/djangoapps/', '/Library/Frameworks/Python64.framework/
Versions/2.6/lib/python26.zip', '/Library/Frameworks/
Python64.framework/Versions/2.6/lib/python2.6', '/Library/Frameworks/
Python64.framework/Versions/2.6/lib/python2.6/plat-darwin', '/Library/
Frameworks/Python64.framework/Versions/2.6/lib/python2.6/plat-mac', '/
Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/plat-
mac/lib-scriptpackages', '/Library/Frameworks/Python64.framework/
Versions/2.6/lib/python2.6/lib-tk', '/Library/Frameworks/
Python64.framework/Versions/2.6/lib/python2.6/lib-old', '/Library/
Frameworks/Python64.framework/Versions/2.6/lib/python2.6/lib-dynload',
'/Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/
site-packages']
Server time:Mon, 5 Jan 2009 08:20:20 +0100

Environment:

Request Method: POST
Request URL: http://127.0.0.1/myapp/upload/2009-01-03/1
Django Version: 1.0.2 final
Python Version: 2.6.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'systemic.peergroup']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/handlers/base.py" in get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "/djangoapps/myapp/../myapp/application1/views.py" in upload_file
  137. form = UploadFileForm(request.POST, request.FILES)
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/handlers/wsgi.py" in _get_post
  169. self._load_post_and_files()
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/handlers/wsgi.py" in
_load_post_and_files
  135. self._post, self._files =
self.parse_file_upload(self.META, self.environ['wsgi.input'])
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/__init__.py" in parse_file_upload
  124. return parser.parse()
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in parse
  134. for item_type, meta_data, field_stream in Parser
(stream, self._boundary):
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in __iter__
  607. for sub_stream in boundarystream:
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in next
  421. return LazyStream(BoundaryIter(self._stream,
self._boundary))
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in __init__
  447. unused_char = self._stream.read(1)
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in read
  300. out = ''.join(parts())
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in parts
  293. chunk = self.next()
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in next
  315. output = self._producer.next()
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in next
  376. data = self.flo.read(self.chunk_size)
File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
python2.6/site-packages/django/http/multipartparser.py" in read
  406. return self._file.read(num_bytes)

Exception Type: IOError at /myapp/upload/2009-01-03/1
Exception Value: request data read error

I tried to switch to daemon mode but no behavioral differences:

The configuration I use in apache (basically coming from
http://code.djangoproject.com/wiki/django_apache_and_mod_wsgi) is the
following:

Alias /djadmin/ "/adminmedia/"

Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing


WSGIDaemonProcess site-1 user=auser group=agroup threads=25
WSGIProces

Re: File upload failing occasionally

2009-01-04 Thread Graham Dumpleton



On Jan 5, 10:24 am, ppdo  wrote:
> Hi all,
>
> I am trying to port my first Django 1.0.2 application to run on OSX/
> Leopard with Apache + mod_python 3.3.1 + python 2.6.1 (all running in
> 64-bit mode) and I am experiencing an occasional error when uploading
> a file that was not present when testing with the Django development
> server.
>
> The code for the upload is similar to what described in the Django
> documentation:
>
> class UploadFileForm(forms.Form):
>     file  = forms.FileField()
>     description = forms.CharField(max_length=100)
>     notifygroup = forms.BooleanField(label='Notify Group?',
> required=False)
>
> def upload_file(request, date, meetingid ):
>     print date, meetingid
>     if request.method == 'POST':
>         print 'before reloading the form...'
>         form = UploadFileForm(request.POST, request.FILES)
>         print 'after reloading the form'
>         if form.is_valid():
>             try:
>                 handle_uploaded_file(request.FILES['file'],
> request.REQUEST['date'], request.REQUEST['description'],
> form.cleaned_data['notifygroup'], meetingid )
>             except:
>                 return render_to_response('uploaded.html',
> { 'message': 'Error! File not uploaded!' })
>             return HttpResponseRedirect('/myapp/uploaded/')
>     else:
>         form = UploadFileForm()
>     return render_to_response('upload.html', {'form': form,
> 'date':date, 'meetingid':meetingid})
>
> This code normally works correctly, but sometimes (say, once every 10
> uploads) and after a fairly long waiting time, it fails with the
> following error:
>
> IOError at /myapp/upload/2009-01-03/1
> Client read error (Timeout?)
> Request Method: POST
> Request URL:    http://192.168.0.164/myapp/upload/2009-01-03/1
> Exception Type: IOError
> Exception Value:
> Client read error (Timeout?)
> Exception Location:     /Library/Frameworks/Python64.framework/Versions/
> 2.6/lib/python2.6/site-packages/django/http/multipartparser.py in
> read, line 406
> Python Executable:      /usr/sbin/httpd
> Python Version: 2.6.1
> Python Path:    ['/djangoapps/myapp/', '/djangoapps/', '/Library/
> Frameworks/Python64.framework/Versions/2.6/lib/python26.zip', '/
> Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6', '/
> Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/plat-
> darwin', '/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/plat-mac', '/Library/Frameworks/Python64.framework/Versions/
> 2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/Library/Frameworks/
> Python64.framework/Versions/2.6/lib/python2.6/lib-tk', '/Library/
> Frameworks/Python64.framework/Versions/2.6/lib/python2.6/lib-old', '/
> Library/Frameworks/Python64.framework/Versions/2.6/lib/python2.6/lib-
> dynload', '/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages']
> Server time:    Sun, 4 Jan 2009 22:42:04 +0100
>
> Environment:
>
> Request Method: POST
> Request URL:http://192.168.0.164/myapp/upload/2009-01-03/1
> Django Version: 1.0.2 final
> Python Version: 2.6.1
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'myapp.application1']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
> Traceback:
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/core/handlers/base.py" in get_response
>   86.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "/djangoapps/myapp/../myapp/application1/views.py" in upload_file
>   137.         form = UploadFileForm(request.POST, request.FILES)
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/core/handlers/modpython.py" in
> _get_post
>   113.             self._load_post_and_files()
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/core/handlers/modpython.py" in
> _load_post_and_files
>   87.                 self._post, self._files = self.parse_file_upload
> (self.META, self._req)
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/__init__.py" in parse_file_upload
>   124.         return parser.parse()
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in parse
>   134.             for item_type, meta_data, field_stream in Parser
> (stream, self._boundary):
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipartparser.py" in __iter__
>   607.         for sub_stream in boundarystream:
> File "/Library/Frameworks/Python64.framework/Versions/2.6/lib/
> python2.6/site-packages/django/http/multipar

Re: File upload problem

2008-10-29 Thread Benedict Verheyen

Roodie wrote:
> Hello,
> 
> I have an interesting problem. One of the users of my ( test ) django
> site reported that he cannot upload image banners to the site using
> the custom admin. I've checked the logs, and found the following
> exception logged:
> 
> Traceback (most recent call last):
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 86, in get_response
> response = callback(request, *callback_args, **callback_kwargs)
>   File "/home/django/inkvizitor/admin_banner.py", line 53, in
> edit_banner
> f = BannerEditForm(request.POST, request.FILES,
> instance=banner_obj)
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> wsgi.py", line 169, in _get_post
> self._load_post_and_files()
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> wsgi.py", line 135, in _load_post_and_files
> self._post, self._files = self.parse_file_upload(self.META,
> self.environ['wsgi.input'])
>   File "/usr/lib/python2.4/site-packages/django/http/__init__.py",
> line 124, in parse_file_upload
> return parser.parse()
>   File "/usr/lib/python2.4/site-packages/django/http/
> multipartparser.py", line 193, in parse
> for chunk in field_stream:
>   File "/usr/lib/python2.4/site-packages/django/http/
> multipartparser.py", line 315, in next
> output = self._producer.next()
>   File "/usr/lib/python2.4/site-packages/django/http/
> multipartparser.py", line 469, in next
> for bytes in stream:
>   File "/usr/lib/python2.4/site-packages/django/http/
> multipartparser.py", line 315, in next
> output = self._producer.next()
>   File "/usr/lib/python2.4/site-packages/django/http/
> multipartparser.py", line 376, in next
> data = self.flo.read(self.chunk_size)
>   File "/usr/lib/python2.4/site-packages/django/http/
> multipartparser.py", line 406, in read
> return self._file.read(num_bytes)
>   File "build/bdist.linux-i686/egg/flup/server/fcgi_base.py", line
> 161, in read
>   File "build/bdist.linux-i686/egg/flup/server/fcgi_base.py", line
> 147, in _waitForData
>   File "build/bdist.linux-i686/egg/flup/server/fcgi_base.py", line
> 673, in process_input
>   File "build/bdist.linux-i686/egg/flup/server/fcgi_base.py", line
> 474, in read
> EOFError
> 
> The setup: apache / fcgi.
> 
> I was unable to reproduce this error, it works perfectly. File
> permissions are OK.
> 
> Any idea what the problem is?
> 
> Thanks!
> Istvan

It might be a corrupt image. Have you checked that banner in a graphics
viewer to see if it loads/looks ok?
Or the connection of the user might be disconnected while he was trying
to upload the image resulting in the EOF?

Regards,
Benedict


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload progress bar for Django?

2008-10-22 Thread Ian Lawrence

Hi
very cool..thx for putting this together. You have saved me some time!

Ian


-- 
http://ianlawrence.info

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload progress bar for Django?

2008-10-22 Thread john

On Oct 20, 2008, at 12:22 PM, M Godshall wrote:

> Is anyone familiar with a django or python tutorial that shows how  
> to implement
> some kind of file upload progress bar?  Ideally I'd like to use
> jquery, but I'm open to anything at this point.  Any links or code
> examples would be greatly appreciated.

I couldn't find any tutorials, but it's come up on this list before:

http://groups.google.com/group/django-users/search?group=django-users&q=progress+bar

And there are a couple of good examples on djangosnippets.org:

http://djangosnippets.org/snippets/678
http://djangosnippets.org/snippets/679

Unfortunately they're not accessible at the moment.

Since it keeps coming up, I put together a demo app showing how the  
pieces fit together. It also shows how you could use nginx and its  
mod_uploadprogress instead, to avoid tying up your Django processes  
with slow uploads.

http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress-bars-jquery-django-nginx/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload progress bar for Django?

2008-10-21 Thread john

On Oct 20, 2008, at 12:22 PM, M Godshall wrote:

> Is anyone familiar with a django or python tutorial that shows how  
> to implement
> some kind of file upload progress bar?  Ideally I'd like to use
> jquery, but I'm open to anything at this point.  Any links or code
> examples would be greatly appreciated.

I couldn't find any tutorials, but it's come up on this list before:

http://groups.google.com/group/django-users/search?group=django-users&q=progress+bar

And there are a couple of good examples on djangosnippets.org:

http://djangosnippets.org/snippets/678
http://djangosnippets.org/snippets/679

Unfortunately they're not accessible at the moment.

Since it keeps coming up, I put together a demo app showing how the  
pieces fit together. It also shows how you could use nginx and its  
mod_uploadprogress instead, to avoid tying up your Django processes  
with slow uploads.

http://www.fairviewcomputing.com/blog/2008/10/21/ajax-upload-progress-bars-jquery-django-nginx/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload progress bar for Django?

2008-10-21 Thread john Moylan
There are working examples around. Basically get your server to report the
upload status to a javascript ui at intervals. Try searching the
djangoproject trac server - there is a link from there to a django uploader
project on google code that I have used in the past. I think it uses JQuery.

I'd search the the link myself to put it into this email but it's been a
very long dayneed sleep.

J

2008/10/21 jonknee <[EMAIL PROTECTED]>

>
> On Oct 20, 7:15 pm, Sascha Brossmann <[EMAIL PROTECTED]>
> wrote:
> > > Is anyone
> > > familiar with a django or python tutorial that shows how to implement
> > > some kind of file upload progress bar?
> >
> > Sorry, but the main magic in those uploaders is done via flash, not
> > via js or php. AFAIK there is currently no sane (though you may use
> > Java ;-)) way to do it otherwise.
>
> You can do it with some JavaScript and a server-side script written in
> most languages besides PHP (though I think there is now a way with an
> extension in 5.2). Perl is commonly used in the pre-made solutions as
> it's typically available and involves little setup.
>
> Flash is most likely easier as there are lots of pre-made solutions,
> but can have some session and compatibility issues (the recent Flash
> 10 update messed up a *lot* of upload forms around the web).
>
> You could make a Django upload handler to do the progress updates, the
> docs even talk about this:
>
> http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload progress bar for Django?

2008-10-21 Thread jonknee

On Oct 20, 7:15 pm, Sascha Brossmann <[EMAIL PROTECTED]>
wrote:
> > Is anyone
> > familiar with a django or python tutorial that shows how to implement
> > some kind of file upload progress bar?
>
> Sorry, but the main magic in those uploaders is done via flash, not
> via js or php. AFAIK there is currently no sane (though you may use
> Java ;-)) way to do it otherwise.

You can do it with some JavaScript and a server-side script written in
most languages besides PHP (though I think there is now a way with an
extension in 5.2). Perl is commonly used in the pre-made solutions as
it's typically available and involves little setup.

Flash is most likely easier as there are lots of pre-made solutions,
but can have some session and compatibility issues (the recent Flash
10 update messed up a *lot* of upload forms around the web).

You could make a Django upload handler to do the progress updates, the
docs even talk about this:

http://docs.djangoproject.com/en/dev/topics/http/file-uploads/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload progress bar for Django?

2008-10-21 Thread varikin



On Oct 20, 6:15 pm, Sascha Brossmann <[EMAIL PROTECTED]>
wrote:
> > Is anyone
> > familiar with a django or python tutorial that shows how to implement
> > some kind of file upload progress bar?
>
> Sorry, but the main magic in those uploaders is done via flash, not
> via js or php. AFAIK there is currently no sane (though you may use
> Java ;-)) way to do it otherwise.

I also think some JavaScript libraries offer them to, like jQuery, but
I have tried any of that.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: File upload progress bar for Django?

2008-10-20 Thread Sascha Brossmann

> Is anyone
> familiar with a django or python tutorial that shows how to implement
> some kind of file upload progress bar?

Sorry, but the main magic in those uploaders is done via flash, not
via js or php. AFAIK there is currently no sane (though you may use
Java ;-)) way to do it otherwise.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >