From lists at mjbayer.de Tue Oct 2 11:05:47 2018 From: lists at mjbayer.de (Michael Bayer) Date: Tue, 2 Oct 2018 17:05:47 +0200 (CEST) Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers Message-ID: <1238430426.570748.1538492747676@webmail.strato.com> Hi everyone, I discovered a funny behavior of my flask app, when running on ARM based apache wsgi servers. Could you please give me some hints to debug this? :-) I have a flask application, that supports file upload. It runs on an ARM based debian stable server with apache wsgi. If I upload small files, everything is fine. The problem appears, when I upload files with a file size >64kb. The famous "Bad request - The browser (or proxy) sent a request that this server could not understand." pops up. Things I tried out so far: - Deploying my flask app to my productive ARM based webserver (debian stable): Here I discovered the issue. - Running in flask's development wsgi server on my Development PC: No problem, I can upload files with any size I want. - Clean debian stable installation in a virtualbox on my Development PC (AMD64) same packages as my productive server, but AMD64 instead of armhf (apache, mod_wsgi): Again no problems at all. - Clean installation of raspian on a spare ARM Raspberry Pi (based on debian 9) with apache, mod_wsgi: Here comes the problem again! - Increase apache LogLevel to debug -> no error logged - Activate FileLogging inside my flask app -> no error logged Have you seen anything like this? I unfortunately do not have much experience with web servers/development so I'm stuck with my debugging approaches :/ What could I do besides that? What information do you need from my side? I can provide any code/configuration you need. Thank you and have a nice day! Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From stappers at stappers.nl Tue Oct 2 17:39:24 2018 From: stappers at stappers.nl (Geert Stappers) Date: Tue, 2 Oct 2018 23:39:24 +0200 Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers In-Reply-To: <1238430426.570748.1538492747676@webmail.strato.com> References: <1238430426.570748.1538492747676@webmail.strato.com> Message-ID: <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: > Hi everyone, > > I discovered a funny behavior of my flask app, when running on ARM > based apache wsgi servers. Could you please give me some hints to > debug this? :-) > > I have a flask application, that supports file upload. > It runs on an ARM based debian stable server with apache wsgi. > If I upload small files, everything is fine. The problem appears, > when I upload files with a file size >64kb. The famous "Bad request > - The browser (or proxy) sent a request that this server could not > understand." pops up. > > Things I tried out so far: > - Deploying my flask app to my productive ARM based webserver (debian > stable): Here I discovered the issue. > - Running in flask's development wsgi server on my Development PC: > No problem, I can upload files with any size I want. > - Clean debian stable installation in a virtualbox on my Development > PC (AMD64) same packages as my productive server, but AMD64 instead > of armhf (apache, mod_wsgi): Again no problems at all. > - Clean installation of raspian on a spare ARM Raspberry Pi (based on > debian 9) with apache, mod_wsgi: Here comes the problem again! > - Increase apache LogLevel to debug -> no error logged > - Activate FileLogging inside my flask app -> no error logged > > Have you seen anything like this? No. Thing that intriges me, is that 64K is a 16-bit limit. ARMHF versus AMD64 is 32-bit vs 64-bit ... > I unfortunately do not have much experience with web servers/development > so I'm stuck with my debugging approaches :/ > > What could I do besides that? Consider it a none flask problem, it will allow you to look at Apache, uWSGI, Python and other links in the chain. Is a webproxy involved?? > What information do you need from my side? > I can provide any code/configuration you need. That will help reproducing the problem. > Thank you and have a nice day! > Michael Groeten Geert Stappers -- Leven en laten leven From lists at mjbayer.de Wed Oct 3 09:41:58 2018 From: lists at mjbayer.de (Michael Bayer) Date: Wed, 3 Oct 2018 15:41:58 +0200 Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers In-Reply-To: <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> References: <1238430426.570748.1538492747676@webmail.strato.com> <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> Message-ID: <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> Am 02.10.2018 um 23:39 schrieb Geert Stappers: > On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: >> Hi everyone, >> >> I discovered a funny behavior of my flask app, when running on ARM >> based apache wsgi servers. Could you please give me some hints to >> debug this? >> >> I have a flask application, that supports file upload. >> It runs on an ARM based debian stable server with apache wsgi. >> If I upload small files, everything is fine. The problem appears, >> when I upload files with a file size >64kb. The famous "Bad request >> - The browser (or proxy) sent a request that this server could not >> understand." pops up. >> >> Things I tried out so far: >> - Deploying my flask app to my productive ARM based webserver (debian >> ?? stable): Here I discovered the issue. >> - Running in flask's development wsgi server on my Development PC: >> ??? No problem, I can upload files with any size I want. >> - Clean debian stable installation in a virtualbox on my Development >> ?? PC (AMD64) same packages as my productive server, but AMD64 instead >> ?? of armhf (apache, mod_wsgi): Again no problems at all. >> - Clean installation of raspian on a spare ARM Raspberry Pi (based on >> ?? debian 9) with apache, mod_wsgi: Here comes the problem again! >> - Increase apache LogLevel to debug -> no error logged >> - Activate FileLogging inside my flask app -> no error logged >> >> Have you seen anything like this? > No. > > Thing that intriges me, is that 64K?? is a 16-bit limit. > ARMHF versus AMD64? is 32-bit vs 64-bit ... Thanks for your answer! Yes, this is strange. I also don't have an explanation > >> I unfortunately do not have much experience with web servers/development >> so I'm stuck with my debugging approaches :/ >> >> What could I do besides that? > Consider it a none flask problem, it will allow you to look at Apache, > uWSGI, Python and other links in the chain. Is a webproxy involved?? There is no proxy in the network. >> What information do you need from my side? >> I can provide any code/configuration you need. > That will help reproducing the problem. I created a minimal example to reproduce the error: https://github.com/mjbayer/flask-upload-issue-arm This repo contains code, configuration and example files that can be used for upload. Here is a demo Raspberry Pi (just for that purpose) to try it out: http://rgb.mjbayer.de/trackdb/ (I could also give ssh access to the Raspi if required) If you run the code in flasks development wsgi server or apache mod_wsgi on AMD64, you will not see the issue. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From scott.werner.vt at gmail.com Wed Oct 3 10:47:42 2018 From: scott.werner.vt at gmail.com (Scott Werner) Date: Wed, 3 Oct 2018 10:47:42 -0400 Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers In-Reply-To: <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> References: <1238430426.570748.1538492747676@webmail.strato.com> <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> Message-ID: Michael, Is it possible that the uploaded file size is causing the server to run out of memory when saving? You can try saving it in chunks: def read_in_chunks(file_object, block_size=1024): """Return a generator which yields data in chunks. Source: `read-file-in-chunks-ram-usage-read-strings-from-binary-file `_ :param file_object: File object to read in chunks. :type file_object: file object :param block_size: (optional) Chunk size. :type block_size: int :yield: The next chunk in file object. :yield type: `bytes` """ for chunk in iter(lambda: file_object.read(block_size), b''): yield chunk @app.route("/add", methods=["GET", "POST"]) def add(): ... # gpx_file.save(gpx_fspath) with open(gpx_fspath, 'wb') as file_: for data in read_in_chunks(gpx_file.stream): file_.write(data) https://github.com/scottwernervt/flask-upload-issue-arm/blob/master/views.py On Wed, Oct 3, 2018 at 9:42 AM Michael Bayer wrote: > > Am 02.10.2018 um 23:39 schrieb Geert Stappers: > > On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: > > Hi everyone, > > I discovered a funny behavior of my flask app, when running on ARM > based apache wsgi servers. Could you please give me some hints to > debug this? > > I have a flask application, that supports file upload. > It runs on an ARM based debian stable server with apache wsgi. > If I upload small files, everything is fine. The problem appears, > when I upload files with a file size >64kb. The famous "Bad request > - The browser (or proxy) sent a request that this server could not > understand." pops up. > > Things I tried out so far: > - Deploying my flask app to my productive ARM based webserver (debian > stable): Here I discovered the issue. > - Running in flask's development wsgi server on my Development PC: > No problem, I can upload files with any size I want. > - Clean debian stable installation in a virtualbox on my Development > PC (AMD64) same packages as my productive server, but AMD64 instead > of armhf (apache, mod_wsgi): Again no problems at all. > - Clean installation of raspian on a spare ARM Raspberry Pi (based on > debian 9) with apache, mod_wsgi: Here comes the problem again! > - Increase apache LogLevel to debug -> no error logged > - Activate FileLogging inside my flask app -> no error logged > > Have you seen anything like this? > > No. > > Thing that intriges me, is that 64K is a 16-bit limit. > ARMHF versus AMD64 is 32-bit vs 64-bit ... > > Thanks for your answer! > Yes, this is strange. I also don't have an explanation > > > I unfortunately do not have much experience with web servers/development > so I'm stuck with my debugging approaches :/ > > What could I do besides that? > > Consider it a none flask problem, it will allow you to look at Apache, > uWSGI, Python and other links in the chain. Is a webproxy involved?? > > > There is no proxy in the network. > > > What information do you need from my side? > I can provide any code/configuration you need. > > That will help reproducing the problem. > > I created a minimal example to reproduce the error: > https://github.com/mjbayer/flask-upload-issue-arm > > This repo contains code, configuration and example files that can be used > for upload. > > Here is a demo Raspberry Pi (just for that purpose) to try it out: > http://rgb.mjbayer.de/trackdb/ > (I could also give ssh access to the Raspi if required) > > If you run the code in flasks development wsgi server or apache mod_wsgi > on AMD64, you will not see the issue. > > > Michael > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -- Scott Werner scott.werner.vt at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at mjbayer.de Wed Oct 3 12:35:18 2018 From: lists at mjbayer.de (Michael Bayer) Date: Wed, 3 Oct 2018 18:35:18 +0200 Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers In-Reply-To: References: <1238430426.570748.1538492747676@webmail.strato.com> <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> Message-ID: Hi Scott, thanks a lot for the suggestion to save it in chunks. I like the approach and I will take it over :) Unfortunately it did not resolve the issue, I still get the Bad request error. On the Raspi, I have your version in place. Best regards, Michael Am 03.10.2018 um 16:47 schrieb Scott Werner: > Michael, > > Is it possible that the uploaded file size is causing the server to > run out of memory when saving? You can try saving it in chunks: > > def read_in_chunks(file_object, block_size=1024): > ??? """Return a generator which yields data in chunks. > > ??? Source: `read-file-in-chunks-ram-usage-read-strings-from-binary-file > ??? read-file-in-chunks-ram-usage-read-strings-from-binary-files>`_ > > ??? :param file_object: File object to read in chunks. > ??? :type file_object: file object > > ??? :param block_size: (optional) Chunk size. > ??? :type block_size: int > > ??? :yield: The next chunk in file object. > ??? :yield type: `bytes` > ??? """ > ??? for chunk in iter(lambda: file_object.read(block_size), b''): > ??????? yield chunk > > @app.route("/add", methods=["GET", "POST"]) > def add(): > ??? ... > ??? # gpx_file.save(gpx_fspath) > with open(gpx_fspath, 'wb') as file_: > ??????? for data in read_in_chunks(gpx_file.stream): > ??????????? file_.write(data) > > https://github.com/scottwernervt/flask-upload-issue-arm/blob/master/views.py > > On Wed, Oct 3, 2018 at 9:42 AM Michael Bayer > wrote: > > > Am 02.10.2018 um 23:39 schrieb Geert Stappers: >> On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: >>> Hi everyone, >>> >>> I discovered a funny behavior of my flask app, when running on ARM >>> based apache wsgi servers. Could you please give me some hints to >>> debug this? >>> >>> I have a flask application, that supports file upload. >>> It runs on an ARM based debian stable server with apache wsgi. >>> If I upload small files, everything is fine. The problem appears, >>> when I upload files with a file size >64kb. The famous "Bad request >>> - The browser (or proxy) sent a request that this server could not >>> understand." pops up. >>> >>> Things I tried out so far: >>> - Deploying my flask app to my productive ARM based webserver >>> (debian >>> ?? stable): Here I discovered the issue. >>> - Running in flask's development wsgi server on my Development PC: >>> ??? No problem, I can upload files with any size I want. >>> - Clean debian stable installation in a virtualbox on my >>> Development >>> ?? PC (AMD64) same packages as my productive server, but AMD64 >>> instead >>> ?? of armhf (apache, mod_wsgi): Again no problems at all. >>> - Clean installation of raspian on a spare ARM Raspberry Pi >>> (based on >>> ?? debian 9) with apache, mod_wsgi: Here comes the problem again! >>> - Increase apache LogLevel to debug -> no error logged >>> - Activate FileLogging inside my flask app -> no error logged >>> >>> Have you seen anything like this? >> No. >> >> Thing that intriges me, is that 64K?? is a 16-bit limit. >> ARMHF versus AMD64? is 32-bit vs 64-bit ... > Thanks for your answer! > Yes, this is strange. I also don't have an explanation >> >>> I unfortunately do not have much experience with web >>> servers/development >>> so I'm stuck with my debugging approaches :/ >>> >>> What could I do besides that? >> Consider it a none flask problem, it will allow you to look at >> Apache, >> uWSGI, Python and other links in the chain. Is a webproxy involved?? > > There is no proxy in the network. > > >>> What information do you need from my side? >>> I can provide any code/configuration you need. >> That will help reproducing the problem. > I created a minimal example to reproduce the error: > https://github.com/mjbayer/flask-upload-issue-arm > > This repo contains code, configuration and example files that can > be used for upload. > > Here is a demo Raspberry Pi (just for that purpose) to try it out: > http://rgb.mjbayer.de/trackdb/ > (I could also give ssh access to the Raspi if required) > > If you run the code in flasks development wsgi server or apache > mod_wsgi on AMD64, you will not see the issue. > > > Michael > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > > > -- > Scott Werner > scott.werner.vt at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From manojcs12 at gmail.com Thu Oct 4 03:10:53 2018 From: manojcs12 at gmail.com (Manoj Choudhary) Date: Thu, 4 Oct 2018 09:10:53 +0200 Subject: [Flask] Python app deployment on linux using apache+mod_wsgi Message-ID: Hi , I have deployed the python app on Linux machine using apache+mod_wsgi. The logs from the python app are written in the apache error file. I have already seperate log files for the app. How can I avoid logs being written in the Apache file. Thanks for your help in advance. Regards, Manoj -- Thanks & Regards, Manoj -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidnieder at gmx.de Thu Oct 4 03:49:15 2018 From: davidnieder at gmx.de (David Nieder) Date: Thu, 4 Oct 2018 09:49:15 +0200 Subject: [Flask] Python app deployment on linux using apache+mod_wsgi In-Reply-To: References: Message-ID: <227718de-7342-bd0f-be6e-70495787e69c@gmx.de> On 04.10.18 09:10, Manoj Choudhary wrote: > Hi , > > I have deployed the python app on Linux machine using apache+mod_wsgi. > > The logs from the python app are written in the apache error file. > I have already seperate log files for the app. > > How can I avoid logs being written in the Apache file. > Thanks for your help in advance. > Use "CustomLog" and "ErrorLog" in your Apache config. https://httpd.apache.org/docs/current/mod/mod_log_config.html#customlog If you don't want logs at all just write them to /dev/null > Regards, > Manoj > > From antondique at gmail.com Thu Oct 4 03:57:28 2018 From: antondique at gmail.com (Anton Dique) Date: Thu, 4 Oct 2018 09:57:28 +0200 Subject: [Flask] Flask Digest, Vol 40, Issue 3 In-Reply-To: References: Message-ID: help - unsubscribe me please On Thu, Oct 4, 2018 at 9:54 AM wrote: > Send Flask mailing list submissions to > flask at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/flask > or, via email, send a message with subject or body 'help' to > flask-request at python.org > > You can reach the person managing the list at > flask-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Flask digest..." > > > Today's Topics: > > 1. Re: File upload breaks for files with size >64kb on ARM based > apache wsgi servers (Michael Bayer) > 2. Python app deployment on linux using apache+mod_wsgi > (Manoj Choudhary) > 3. Re: Python app deployment on linux using apache+mod_wsgi > (David Nieder) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 3 Oct 2018 18:35:18 +0200 > From: Michael Bayer > To: Scott Werner > Cc: flask at python.org > Subject: Re: [Flask] File upload breaks for files with size >64kb on > ARM based apache wsgi servers > Message-ID: > Content-Type: text/plain; charset="utf-8"; Format="flowed" > > Hi Scott, > > thanks a lot for the suggestion to save it in chunks. I like the > approach and I will take it over :) > > Unfortunately it did not resolve the issue, I still get the Bad request > error. > > On the Raspi, I have your version in place. > > Best regards, > > Michael > > > Am 03.10.2018 um 16:47 schrieb Scott Werner: > > Michael, > > > > Is it possible that the uploaded file size is causing the server to > > run out of memory when saving? You can try saving it in chunks: > > > > def read_in_chunks(file_object, block_size=1024): > > ??? """Return a generator which yields data in chunks. > > > > ??? Source: `read-file-in-chunks-ram-usage-read-strings-from-binary-file > > ??? > read-file-in-chunks-ram-usage-read-strings-from-binary-files>`_ > > > > ??? :param file_object: File object to read in chunks. > > ??? :type file_object: file object > > > > ??? :param block_size: (optional) Chunk size. > > ??? :type block_size: int > > > > ??? :yield: The next chunk in file object. > > ??? :yield type: `bytes` > > ??? """ > > ??? for chunk in iter(lambda: file_object.read(block_size), b''): > > ??????? yield chunk > > > > @app.route("/add", methods=["GET", "POST"]) > > def add(): > > ??? ... > > ??? # gpx_file.save(gpx_fspath) > > with open(gpx_fspath, 'wb') as file_: > > ??????? for data in read_in_chunks(gpx_file.stream): > > ??????????? file_.write(data) > > > > > https://github.com/scottwernervt/flask-upload-issue-arm/blob/master/views.py > > > > On Wed, Oct 3, 2018 at 9:42 AM Michael Bayer > > wrote: > > > > > > Am 02.10.2018 um 23:39 schrieb Geert Stappers: > >> On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: > >>> Hi everyone, > >>> > >>> I discovered a funny behavior of my flask app, when running on ARM > >>> based apache wsgi servers. Could you please give me some hints to > >>> debug this? > >>> > >>> I have a flask application, that supports file upload. > >>> It runs on an ARM based debian stable server with apache wsgi. > >>> If I upload small files, everything is fine. The problem appears, > >>> when I upload files with a file size >64kb. The famous "Bad request > >>> - The browser (or proxy) sent a request that this server could not > >>> understand." pops up. > >>> > >>> Things I tried out so far: > >>> - Deploying my flask app to my productive ARM based webserver > >>> (debian > >>> ?? stable): Here I discovered the issue. > >>> - Running in flask's development wsgi server on my Development PC: > >>> ??? No problem, I can upload files with any size I want. > >>> - Clean debian stable installation in a virtualbox on my > >>> Development > >>> ?? PC (AMD64) same packages as my productive server, but AMD64 > >>> instead > >>> ?? of armhf (apache, mod_wsgi): Again no problems at all. > >>> - Clean installation of raspian on a spare ARM Raspberry Pi > >>> (based on > >>> ?? debian 9) with apache, mod_wsgi: Here comes the problem again! > >>> - Increase apache LogLevel to debug -> no error logged > >>> - Activate FileLogging inside my flask app -> no error logged > >>> > >>> Have you seen anything like this? > >> No. > >> > >> Thing that intriges me, is that 64K?? is a 16-bit limit. > >> ARMHF versus AMD64? is 32-bit vs 64-bit ... > > Thanks for your answer! > > Yes, this is strange. I also don't have an explanation > >> > >>> I unfortunately do not have much experience with web > >>> servers/development > >>> so I'm stuck with my debugging approaches :/ > >>> > >>> What could I do besides that? > >> Consider it a none flask problem, it will allow you to look at > >> Apache, > >> uWSGI, Python and other links in the chain. Is a webproxy involved?? > > > > There is no proxy in the network. > > > > > >>> What information do you need from my side? > >>> I can provide any code/configuration you need. > >> That will help reproducing the problem. > > I created a minimal example to reproduce the error: > > https://github.com/mjbayer/flask-upload-issue-arm > > > > This repo contains code, configuration and example files that can > > be used for upload. > > > > Here is a demo Raspberry Pi (just for that purpose) to try it out: > > http://rgb.mjbayer.de/trackdb/ > > (I could also give ssh access to the Raspi if required) > > > > If you run the code in flasks development wsgi server or apache > > mod_wsgi on AMD64, you will not see the issue. > > > > > > Michael > > > > _______________________________________________ > > Flask mailing list > > Flask at python.org > > https://mail.python.org/mailman/listinfo/flask > > > > > > > > -- > > Scott Werner > > scott.werner.vt at gmail.com > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/flask/attachments/20181003/5a697979/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Thu, 4 Oct 2018 09:10:53 +0200 > From: Manoj Choudhary > To: "flask at python.org" > Subject: [Flask] Python app deployment on linux using apache+mod_wsgi > Message-ID: > JG4OWsLA4cVwzwWQ at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Hi , > > I have deployed the python app on Linux machine using apache+mod_wsgi. > > The logs from the python app are written in the apache error file. > I have already seperate log files for the app. > > How can I avoid logs being written in the Apache file. > Thanks for your help in advance. > > Regards, > Manoj > -- > Thanks & Regards, > Manoj > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/flask/attachments/20181004/2f8de39a/attachment-0001.html > > > > ------------------------------ > > Message: 3 > Date: Thu, 4 Oct 2018 09:49:15 +0200 > From: David Nieder > To: flask at python.org > Subject: Re: [Flask] Python app deployment on linux using > apache+mod_wsgi > Message-ID: <227718de-7342-bd0f-be6e-70495787e69c at gmx.de> > Content-Type: text/plain; charset=utf-8; format=flowed > > On 04.10.18 09:10, Manoj Choudhary wrote: > > Hi , > > > > I have deployed the python app on Linux machine using apache+mod_wsgi. > > > > The logs from the python app are written in the apache error file. > > I have already seperate log files for the app. > > > > How can I avoid logs being written in the Apache file. > > Thanks for your help in advance. > > > > Use "CustomLog" and "ErrorLog" in your Apache config. > https://httpd.apache.org/docs/current/mod/mod_log_config.html#customlog > > If you don't want logs at all just write them to /dev/null > > > Regards, > > Manoj > > > > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > > ------------------------------ > > End of Flask Digest, Vol 40, Issue 3 > ************************************ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at saschathiele.com Thu Oct 4 06:00:50 2018 From: info at saschathiele.com (Sascha Thiele) Date: Thu, 4 Oct 2018 12:00:50 +0200 (CEST) Subject: [Flask] Flask Digest, Vol 40, Issue 4, Plesk + mod_wsgi 4.6.4 = Make Love, No War! In-Reply-To: References: Message-ID: <461161471.4137.1538647250490@email.1und1.de> An HTML attachment was scrubbed... URL: From lists at mjbayer.de Thu Oct 4 06:23:16 2018 From: lists at mjbayer.de (Michael Bayer) Date: Thu, 4 Oct 2018 12:23:16 +0200 Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers In-Reply-To: <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> References: <1238430426.570748.1538492747676@webmail.strato.com> <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> Message-ID: <7a286efd-7927-c743-e162-6812fb0f3203@mjbayer.de> Hi, short update: - On the ARM device, when I use the flask development wsgi server, I do not have any issues - Using Apache: Even with LogLevel "trace8" I do not see any logs regarding the issue. I compared the traces from a successful upload with a not successful one. Main difference is: The not successful one prints out information about Content-Type and Content-Length and mod_wsgi starts a new process. Both lines are missing in the logs of the successful transmission. Here the logs of a successful <64k file upload: [] Headers received from client:, referer: http://192.168.178.38/trackdb/add []?? Host: 192.168.178.38, referer: http://192.168.178.38/trackdb/add []?? User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0, referer: http://192.168.178.38/trackdb/add []?? Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, referer: http://192.168.178.38/trackdb/add []?? Accept-Language: de-DE, referer: http://192.168.178.38/trackdb/add []?? Accept-Encoding: gzip, deflate, referer: http://192.168.178.38/trackdb/add []?? Referer: http://192.168.178.38/trackdb/add, referer: http://192.168.178.38/trackdb/add []?? DNT: 1, referer: http://192.168.178.38/trackdb/add []?? Connection: keep-alive, referer: http://192.168.178.38/trackdb/add []?? Upgrade-Insecure-Requests: 1, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /trackdb/, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /index.html, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /index.cgi, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /index.pl, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /index.php, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /index.xhtml, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /index.htm, referer: http://192.168.178.38/trackdb/add [] Content-Type 'text/html; charset=utf-8' ..., referer: http://192.168.178.38/trackdb/add [] ... did not match 'application/xml', referer: http://192.168.178.38/trackdb/add [] Content-Type condition for 'deflate' did not match, referer: http://192.168.178.38/trackdb/add [] Content-Type 'text/html; charset=utf-8' ..., referer: http://192.168.178.38/trackdb/add [] ... did not match 'application/rss+xml', referer: http://192.168.178.38/trackdb/add [] Content-Type condition for 'deflate' did not match, referer: http://192.168.178.38/trackdb/add [] Content-Type 'text/html; charset=utf-8' ..., referer: http://192.168.178.38/trackdb/add [] ... did not match 'application/x-javascript', referer: http://192.168.178.38/trackdb/add [] ... did not match 'application/javascript', referer: http://192.168.178.38/trackdb/add [] ... did not match 'application/ecmascript', referer: http://192.168.178.38/trackdb/add [] Content-Type condition for 'deflate' did not match, referer: http://192.168.178.38/trackdb/add [] Content-Type 'text/html; charset=utf-8' ..., referer: http://192.168.178.38/trackdb/add [] ... did not match 'text/css', referer: http://192.168.178.38/trackdb/add [] Content-Type condition for 'deflate' did not match, referer: http://192.168.178.38/trackdb/add [] Content-Type 'text/html; charset=utf-8' ..., referer: http://192.168.178.38/trackdb/add [] ... matched 'text/html', referer: http://192.168.178.38/trackdb/add [] Content-Type condition for 'deflate' matched, referer: http://192.168.178.38/trackdb/add [] Response sent with status 200, headers:, referer: http://192.168.178.38/trackdb/add []?? Date: Thu, 04 Oct 2018 09:20:13 GMT, referer: http://192.168.178.38/trackdb/add []?? Server: Apache/2.4.25 (Raspbian), referer: http://192.168.178.38/trackdb/add []?? Vary: Accept-Encoding, referer: http://192.168.178.38/trackdb/add []?? Content-Encoding: gzip, referer: http://192.168.178.38/trackdb/add []?? Keep-Alive: timeout=5, max=99, referer: http://192.168.178.38/trackdb/add []?? Connection: Keep-Alive, referer: http://192.168.178.38/trackdb/add []?? Transfer-Encoding: chunked, referer: http://192.168.178.38/trackdb/add []?? Content-Type: text/html; charset=utf-8, referer: http://192.168.178.38/trackdb/add [] core_output_filter: flushing because of FLUSH bucket Here the logs of a not successfull >64k file upload: [] Request received from client: POST /trackdb/add HTTP/1.1 [] Headers received from client:, referer: http://192.168.178.38/trackdb/add []?? Host: 192.168.178.38, referer: http://192.168.178.38/trackdb/add []?? User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0, referer: http://192.168.178.38/trackdb/add []?? Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, referer: http://192.168.178.38/trackdb/add []?? Accept-Language: de-DE, referer: http://192.168.178.38/trackdb/add []?? Accept-Encoding: gzip, deflate, referer: http://192.168.178.38/trackdb/add []?? Referer: http://192.168.178.38/trackdb/add, referer: http://192.168.178.38/trackdb/add []?? DNT: 1, referer: http://192.168.178.38/trackdb/add []?? Connection: keep-alive, referer: http://192.168.178.38/trackdb/add []?? Upgrade-Insecure-Requests: 1, referer: http://192.168.178.38/trackdb/add []?? Content-Type: multipart/form-data; boundary=---------------------------1459554725190952609947987496, referer: http://192.168.178.38/trackdb/add []?? Content-Length: 80688, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /trackdb/add, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of Require all granted: granted, referer: http://192.168.178.38/trackdb/add [] AH01626: authorization result of : granted, referer: http://192.168.178.38/trackdb/add [] request authorized without authentication by access_checker_ex hook: /add, referer: http://192.168.178.38/trackdb/add [] mod_wsgi (pid=4976): Create interpreter '127.0.1.1|/trackdb'. [] mod_wsgi (pid=4976, process='', application='127.0.1.1|/trackdb'): Loading WSGI script '/var/www/trackdb/flaskapp.wsgi'., referer: http://192.168.178.38/trackdb/add [] Response sent with status 400, headers:, referer: http://192.168.178.38/trackdb/add []?? Date: Thu, 04 Oct 2018 09:19:27 GMT, referer: http://192.168.178.38/trackdb/add []?? Server: Apache/2.4.25 (Raspbian), referer: http://192.168.178.38/trackdb/add []?? Content-Length: 192, referer: http://192.168.178.38/trackdb/add []?? Connection: close, referer: http://192.168.178.38/trackdb/add []?? Content-Type: text/html, referer: http://192.168.178.38/trackdb/add [] core_output_filter: flushing because of FLUSH bucket Michael Am 03.10.2018 um 15:41 schrieb Michael Bayer: > > Am 02.10.2018 um 23:39 schrieb Geert Stappers: >> On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: >>> Hi everyone, >>> >>> I discovered a funny behavior of my flask app, when running on ARM >>> based apache wsgi servers. Could you please give me some hints to >>> debug this? >>> >>> I have a flask application, that supports file upload. >>> It runs on an ARM based debian stable server with apache wsgi. >>> If I upload small files, everything is fine. The problem appears, >>> when I upload files with a file size >64kb. The famous "Bad request >>> - The browser (or proxy) sent a request that this server could not >>> understand." pops up. >>> >>> Things I tried out so far: >>> - Deploying my flask app to my productive ARM based webserver (debian >>> ?? stable): Here I discovered the issue. >>> - Running in flask's development wsgi server on my Development PC: >>> ??? No problem, I can upload files with any size I want. >>> - Clean debian stable installation in a virtualbox on my Development >>> ?? PC (AMD64) same packages as my productive server, but AMD64 instead >>> ?? of armhf (apache, mod_wsgi): Again no problems at all. >>> - Clean installation of raspian on a spare ARM Raspberry Pi (based on >>> ?? debian 9) with apache, mod_wsgi: Here comes the problem again! >>> - Increase apache LogLevel to debug -> no error logged >>> - Activate FileLogging inside my flask app -> no error logged >>> >>> Have you seen anything like this? >> No. >> >> Thing that intriges me, is that 64K?? is a 16-bit limit. >> ARMHF versus AMD64? is 32-bit vs 64-bit ... > Thanks for your answer! > Yes, this is strange. I also don't have an explanation >> >>> I unfortunately do not have much experience with web >>> servers/development >>> so I'm stuck with my debugging approaches :/ >>> >>> What could I do besides that? >> Consider it a none flask problem, it will allow you to look at Apache, >> uWSGI, Python and other links in the chain. Is a webproxy involved?? > > There is no proxy in the network. > > >>> What information do you need from my side? >>> I can provide any code/configuration you need. >> That will help reproducing the problem. > I created a minimal example to reproduce the error: > https://github.com/mjbayer/flask-upload-issue-arm > > This repo contains code, configuration and example files that can be > used for upload. > > Here is a demo Raspberry Pi (just for that purpose) to try it out: > http://rgb.mjbayer.de/trackdb/ > (I could also give ssh access to the Raspi if required) > > If you run the code in flasks development wsgi server or apache > mod_wsgi on AMD64, you will not see the issue. > > > Michael > > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From scott.werner.vt at gmail.com Thu Oct 4 10:16:06 2018 From: scott.werner.vt at gmail.com (Scott Werner) Date: Thu, 4 Oct 2018 10:16:06 -0400 Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers In-Reply-To: <7a286efd-7927-c743-e162-6812fb0f3203@mjbayer.de> References: <1238430426.570748.1538492747676@webmail.strato.com> <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> <7a286efd-7927-c743-e162-6812fb0f3203@mjbayer.de> Message-ID: > > The not successful one prints out information about Content-Type and > Content-Length and mod_wsgi starts a new process > I am wondering if the new apache mod_wsgi process does not have permission to save the file since it launches a new process to handle the web request. 1. What directory, user, and group is the application being served from? 2. Try setting up your apache config file like http://flask.pocoo.org/docs/1.0/deploying/mod_wsgi/#configuring-apache 1. For debugging. turn on sys.stdout and sys.stderr using: WSGIRestrictStdout Off 2. The syntax for directory permissions changed from 2.2 to 2.4: Require all granted 3. I updated my fork with some print and flash debugging messages: https://github.com/scottwernervt/flask-upload-issue-arm/commits/master/views.py https://modwsgi.readthedocs.io/en/develop/user-guides/debugging-techniques.html On Thu, Oct 4, 2018 at 6:23 AM Michael Bayer wrote: > Hi, > > short update: > > - On the ARM device, when I use the flask development wsgi server, I do > not have any issues > > - Using Apache: Even with LogLevel "trace8" I do not see any logs > regarding the issue. I compared the traces from a successful upload with a > not successful one. Main difference is: The not successful one prints out > information about Content-Type and Content-Length and mod_wsgi starts a new > process. Both lines are missing in the logs of the successful transmission. > > > Here the logs of a successful <64k file upload: > > [] Headers received from client:, referer: > http://192.168.178.38/trackdb/add > [] Host: 192.168.178.38, referer: http://192.168.178.38/trackdb/add > [] User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 > Firefox/52.0, referer: http://192.168.178.38/trackdb/add > [] Accept: > text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, referer: > http://192.168.178.38/trackdb/add > [] Accept-Language: de-DE, referer: http://192.168.178.38/trackdb/add > [] Accept-Encoding: gzip, deflate, referer: > http://192.168.178.38/trackdb/add > [] Referer: http://192.168.178.38/trackdb/add, referer: > http://192.168.178.38/trackdb/add > [] DNT: 1, referer: http://192.168.178.38/trackdb/add > [] Connection: keep-alive, referer: http://192.168.178.38/trackdb/add > [] Upgrade-Insecure-Requests: 1, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /trackdb/, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: /, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /index.html, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /index.cgi, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: / > index.pl, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /index.php, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /index.xhtml, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /index.htm, referer: http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/xml', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/rss+xml', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/x-javascript', referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/javascript', referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/ecmascript', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'text/css', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... matched 'text/html', referer: http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' matched, referer: > http://192.168.178.38/trackdb/add > [] Response sent with status 200, headers:, referer: > http://192.168.178.38/trackdb/add > [] Date: Thu, 04 Oct 2018 09:20:13 GMT, referer: > http://192.168.178.38/trackdb/add > [] Server: Apache/2.4.25 (Raspbian), referer: > http://192.168.178.38/trackdb/add > [] Vary: Accept-Encoding, referer: http://192.168.178.38/trackdb/add > [] Content-Encoding: gzip, referer: http://192.168.178.38/trackdb/add > [] Keep-Alive: timeout=5, max=99, referer: > http://192.168.178.38/trackdb/add > [] Connection: Keep-Alive, referer: http://192.168.178.38/trackdb/add > [] Transfer-Encoding: chunked, referer: > http://192.168.178.38/trackdb/add > [] Content-Type: text/html; charset=utf-8, referer: > http://192.168.178.38/trackdb/add > [] core_output_filter: flushing because of FLUSH bucket > > > Here the logs of a not successfull >64k file upload: > > [] Request received from client: POST /trackdb/add HTTP/1.1 > [] Headers received from client:, referer: > http://192.168.178.38/trackdb/add > [] Host: 192.168.178.38, referer: http://192.168.178.38/trackdb/add > [] User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 > Firefox/52.0, referer: http://192.168.178.38/trackdb/add > [] Accept: > text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, referer: > http://192.168.178.38/trackdb/add > [] Accept-Language: de-DE, referer: http://192.168.178.38/trackdb/add > [] Accept-Encoding: gzip, deflate, referer: > http://192.168.178.38/trackdb/add > [] Referer: http://192.168.178.38/trackdb/add, referer: > http://192.168.178.38/trackdb/add > [] DNT: 1, referer: http://192.168.178.38/trackdb/add > [] Connection: keep-alive, referer: http://192.168.178.38/trackdb/add > [] Upgrade-Insecure-Requests: 1, referer: > http://192.168.178.38/trackdb/add > [] Content-Type: multipart/form-data; > boundary=---------------------------1459554725190952609947987496, referer: > http://192.168.178.38/trackdb/add > [] Content-Length: 80688, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /trackdb/add, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, referer: > http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex hook: > /add, referer: http://192.168.178.38/trackdb/add > [] mod_wsgi (pid=4976): Create interpreter '127.0.1.1|/trackdb'. > [] mod_wsgi (pid=4976, process='', application='127.0.1.1|/trackdb'): > Loading WSGI script '/var/www/trackdb/flaskapp.wsgi'., referer: > http://192.168.178.38/trackdb/add > [] Response sent with status 400, headers:, referer: > http://192.168.178.38/trackdb/add > [] Date: Thu, 04 Oct 2018 09:19:27 GMT, referer: > http://192.168.178.38/trackdb/add > [] Server: Apache/2.4.25 (Raspbian), referer: > http://192.168.178.38/trackdb/add > [] Content-Length: 192, referer: http://192.168.178.38/trackdb/add > [] Connection: close, referer: http://192.168.178.38/trackdb/add > [] Content-Type: text/html, referer: http://192.168.178.38/trackdb/add > [] core_output_filter: flushing because of FLUSH bucket > > Michael > > Am 03.10.2018 um 15:41 schrieb Michael Bayer: > > > Am 02.10.2018 um 23:39 schrieb Geert Stappers: > > On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: > > Hi everyone, > > I discovered a funny behavior of my flask app, when running on ARM > based apache wsgi servers. Could you please give me some hints to > debug this? > > I have a flask application, that supports file upload. > It runs on an ARM based debian stable server with apache wsgi. > If I upload small files, everything is fine. The problem appears, > when I upload files with a file size >64kb. The famous "Bad request > - The browser (or proxy) sent a request that this server could not > understand." pops up. > > Things I tried out so far: > - Deploying my flask app to my productive ARM based webserver (debian > stable): Here I discovered the issue. > - Running in flask's development wsgi server on my Development PC: > No problem, I can upload files with any size I want. > - Clean debian stable installation in a virtualbox on my Development > PC (AMD64) same packages as my productive server, but AMD64 instead > of armhf (apache, mod_wsgi): Again no problems at all. > - Clean installation of raspian on a spare ARM Raspberry Pi (based on > debian 9) with apache, mod_wsgi: Here comes the problem again! > - Increase apache LogLevel to debug -> no error logged > - Activate FileLogging inside my flask app -> no error logged > > Have you seen anything like this? > > No. > > Thing that intriges me, is that 64K is a 16-bit limit. > ARMHF versus AMD64 is 32-bit vs 64-bit ... > > Thanks for your answer! > Yes, this is strange. I also don't have an explanation > > > I unfortunately do not have much experience with web servers/development > so I'm stuck with my debugging approaches :/ > > What could I do besides that? > > Consider it a none flask problem, it will allow you to look at Apache, > uWSGI, Python and other links in the chain. Is a webproxy involved?? > > > There is no proxy in the network. > > > What information do you need from my side? > I can provide any code/configuration you need. > > That will help reproducing the problem. > > I created a minimal example to reproduce the error: > https://github.com/mjbayer/flask-upload-issue-arm > > This repo contains code, configuration and example files that can be used > for upload. > > Here is a demo Raspberry Pi (just for that purpose) to try it out: > http://rgb.mjbayer.de/trackdb/ > (I could also give ssh access to the Raspi if required) > > If you run the code in flasks development wsgi server or apache mod_wsgi > on AMD64, you will not see the issue. > > > Michael > > > > _______________________________________________ > Flask mailing listFlask at python.orghttps://mail.python.org/mailman/listinfo/flask > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -- Scott Werner scott.werner.vt at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at mjbayer.de Thu Oct 4 18:06:46 2018 From: lists at mjbayer.de (Michael Bayer) Date: Fri, 5 Oct 2018 00:06:46 +0200 Subject: [Flask] File upload breaks for files with size >64kb on ARM based apache wsgi servers In-Reply-To: References: <1238430426.570748.1538492747676@webmail.strato.com> <20181002213924.tv4s5whdnyjj4bod@gpm.stappers.nl> <2248efb5-7383-fd68-f925-8751c51a1d75@mjbayer.de> <7a286efd-7927-c743-e162-6812fb0f3203@mjbayer.de> Message-ID: <51403018-d019-0b97-de14-7ed98261c7bf@mjbayer.de> Hi Scott, thanks a lot for your answer :) Sorry, I did not have much time to debug and I will be away from my computer the next couple of days. I will come up with more profound information next week. What I figured out so far: Permission settings seem to be fine. Owner is www-data and got write access (the <64k files are written without problems). The upload folder looks like this: pi at raspberrypi:/var/www/trackdb/static/upload-data $ ls -lah insgesamt 92K drwxr-xr-x 2 www-data www-data 4,0K Okt? 4 21:40 . drwxr-xr-x 3 www-data www-data 4,0K Okt? 4 21:22 .. -rw-r--r-- 1 www-data www-data? 53K Okt? 4 21:23 2013_08_bogenberg.gpx -rw-r--r-- 1 www-data www-data? 26K Okt? 4 21:40 2015_03_21.gpx (The two files are written by the application) Funny is, that os.getlogin() throws an exception "inappropriate ioctl for device os.getlogin()". So I disabled this call. In the background I check the issue for that exception. At first glance there are some mod_wsgi github issues for that as well. Besides that (and a small adaptation in the base template), your fork is deployed to http://rgb.mjbayer.de/trackdb Thanks for the hints regarding the apache config. I will try it as soon as I return home. Best regards Michael Am 04.10.2018 um 16:16 schrieb Scott Werner: > > The not successful one prints out information about Content-Type > and Content-Length and mod_wsgi starts a new process > > > I am wondering if the new apache mod_wsgi process does not have > permission to save the file since it launches a new process to handle > the web request. > > 1. What directory, user, and group is the application being served from? > 2. Try setting up your apache config file like > http://flask.pocoo.org/docs/1.0/deploying/mod_wsgi/#configuring-apache > 1. For debugging. turn on sys.stdout and sys.stderr using: > WSGIRestrictStdout Off > 2. The syntax for directory permissions changed from 2.2 to > 2.4:Require all granted > 3. I updated my fork with some print and flash debugging messages: > https://github.com/scottwernervt/flask-upload-issue-arm/commits/master/views.py > > https://modwsgi.readthedocs.io/en/develop/user-guides/debugging-techniques.html > > On Thu, Oct 4, 2018 at 6:23 AM Michael Bayer > wrote: > > Hi, > > short update: > > - On the ARM device, when I use the flask development wsgi server, > I do not have any issues > > - Using Apache: Even with LogLevel "trace8" I do not see any logs > regarding the issue. I compared the traces from a successful > upload with a not successful one. Main difference is: The not > successful one prints out information about Content-Type and > Content-Length and mod_wsgi starts a new process. Both lines are > missing in the logs of the successful transmission. > > > Here the logs of a successful <64k file upload: > > [] Headers received from client:, referer: > http://192.168.178.38/trackdb/add > []?? Host: 192.168.178.38, referer: http://192.168.178.38/trackdb/add > []?? User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) > Gecko/20100101 Firefox/52.0, referer: > http://192.168.178.38/trackdb/add > []?? Accept: > text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, > referer: http://192.168.178.38/trackdb/add > []?? Accept-Language: de-DE, referer: > http://192.168.178.38/trackdb/add > []?? Accept-Encoding: gzip, deflate, referer: > http://192.168.178.38/trackdb/add > []?? Referer: http://192.168.178.38/trackdb/add, referer: > http://192.168.178.38/trackdb/add > []?? DNT: 1, referer: http://192.168.178.38/trackdb/add > []?? Connection: keep-alive, referer: > http://192.168.178.38/trackdb/add > []?? Upgrade-Insecure-Requests: 1, referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /trackdb/, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /index.html, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /index.cgi, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /index.pl , referer: > http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /index.php, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /index.xhtml, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /index.htm, referer: http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/xml', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/rss+xml', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/x-javascript', referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/javascript', referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'application/ecmascript', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... did not match 'text/css', referer: > http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' did not match, referer: > http://192.168.178.38/trackdb/add > [] Content-Type 'text/html; charset=utf-8' ..., referer: > http://192.168.178.38/trackdb/add > [] ... matched 'text/html', referer: http://192.168.178.38/trackdb/add > [] Content-Type condition for 'deflate' matched, referer: > http://192.168.178.38/trackdb/add > [] Response sent with status 200, headers:, referer: > http://192.168.178.38/trackdb/add > []?? Date: Thu, 04 Oct 2018 09:20:13 GMT, referer: > http://192.168.178.38/trackdb/add > []?? Server: Apache/2.4.25 (Raspbian), referer: > http://192.168.178.38/trackdb/add > []?? Vary: Accept-Encoding, referer: http://192.168.178.38/trackdb/add > []?? Content-Encoding: gzip, referer: > http://192.168.178.38/trackdb/add > []?? Keep-Alive: timeout=5, max=99, referer: > http://192.168.178.38/trackdb/add > []?? Connection: Keep-Alive, referer: > http://192.168.178.38/trackdb/add > []?? Transfer-Encoding: chunked, referer: > http://192.168.178.38/trackdb/add > []?? Content-Type: text/html; charset=utf-8, referer: > http://192.168.178.38/trackdb/add > [] core_output_filter: flushing because of FLUSH bucket > > > Here the logs of a not successfull >64k file upload: > > [] Request received from client: POST /trackdb/add HTTP/1.1 > [] Headers received from client:, referer: > http://192.168.178.38/trackdb/add > []?? Host: 192.168.178.38, referer: http://192.168.178.38/trackdb/add > []?? User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) > Gecko/20100101 Firefox/52.0, referer: > http://192.168.178.38/trackdb/add > []?? Accept: > text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, > referer: http://192.168.178.38/trackdb/add > []?? Accept-Language: de-DE, referer: > http://192.168.178.38/trackdb/add > []?? Accept-Encoding: gzip, deflate, referer: > http://192.168.178.38/trackdb/add > []?? Referer: http://192.168.178.38/trackdb/add, referer: > http://192.168.178.38/trackdb/add > []?? DNT: 1, referer: http://192.168.178.38/trackdb/add > []?? Connection: keep-alive, referer: > http://192.168.178.38/trackdb/add > []?? Upgrade-Insecure-Requests: 1, referer: > http://192.168.178.38/trackdb/add > []?? Content-Type: multipart/form-data; > boundary=---------------------------1459554725190952609947987496, > referer: http://192.168.178.38/trackdb/add > []?? Content-Length: 80688, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /trackdb/add, referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of Require all granted: granted, > referer: http://192.168.178.38/trackdb/add > [] AH01626: authorization result of : granted, > referer: http://192.168.178.38/trackdb/add > [] request authorized without authentication by access_checker_ex > hook: /add, referer: http://192.168.178.38/trackdb/add > [] mod_wsgi (pid=4976): Create interpreter '127.0.1.1|/trackdb'. > [] mod_wsgi (pid=4976, process='', > application='127.0.1.1|/trackdb'): Loading WSGI script > '/var/www/trackdb/flaskapp.wsgi'., referer: > http://192.168.178.38/trackdb/add > [] Response sent with status 400, headers:, referer: > http://192.168.178.38/trackdb/add > []?? Date: Thu, 04 Oct 2018 09:19:27 GMT, referer: > http://192.168.178.38/trackdb/add > []?? Server: Apache/2.4.25 (Raspbian), referer: > http://192.168.178.38/trackdb/add > []?? Content-Length: 192, referer: http://192.168.178.38/trackdb/add > []?? Connection: close, referer: http://192.168.178.38/trackdb/add > []?? Content-Type: text/html, referer: > http://192.168.178.38/trackdb/add > [] core_output_filter: flushing because of FLUSH bucket > > Michael > > > Am 03.10.2018 um 15:41 schrieb Michael Bayer: >> >> Am 02.10.2018 um 23:39 schrieb Geert Stappers: >>> On Tue, Oct 02, 2018 at 05:05:47PM +0200, Michael Bayer wrote: >>>> Hi everyone, >>>> >>>> I discovered a funny behavior of my flask app, when running on ARM >>>> based apache wsgi servers. Could you please give me some hints to >>>> debug this? >>>> >>>> I have a flask application, that supports file upload. >>>> It runs on an ARM based debian stable server with apache wsgi. >>>> If I upload small files, everything is fine. The problem appears, >>>> when I upload files with a file size >64kb. The famous "Bad >>>> request >>>> - The browser (or proxy) sent a request that this server could not >>>> understand." pops up. >>>> >>>> Things I tried out so far: >>>> - Deploying my flask app to my productive ARM based webserver >>>> (debian >>>> ?? stable): Here I discovered the issue. >>>> - Running in flask's development wsgi server on my Development PC: >>>> ??? No problem, I can upload files with any size I want. >>>> - Clean debian stable installation in a virtualbox on my >>>> Development >>>> ?? PC (AMD64) same packages as my productive server, but AMD64 >>>> instead >>>> ?? of armhf (apache, mod_wsgi): Again no problems at all. >>>> - Clean installation of raspian on a spare ARM Raspberry Pi >>>> (based on >>>> ?? debian 9) with apache, mod_wsgi: Here comes the problem again! >>>> - Increase apache LogLevel to debug -> no error logged >>>> - Activate FileLogging inside my flask app -> no error logged >>>> >>>> Have you seen anything like this? >>> No. >>> >>> Thing that intriges me, is that 64K?? is a 16-bit limit. >>> ARMHF versus AMD64? is 32-bit vs 64-bit ... >> Thanks for your answer! >> Yes, this is strange. I also don't have an explanation >>> >>>> I unfortunately do not have much experience with web >>>> servers/development >>>> so I'm stuck with my debugging approaches :/ >>>> >>>> What could I do besides that? >>> Consider it a none flask problem, it will allow you to look at >>> Apache, >>> uWSGI, Python and other links in the chain. Is a webproxy >>> involved?? >> >> There is no proxy in the network. >> >> >>>> What information do you need from my side? >>>> I can provide any code/configuration you need. >>> That will help reproducing the problem. >> I created a minimal example to reproduce the error: >> https://github.com/mjbayer/flask-upload-issue-arm >> >> This repo contains code, configuration and example files that can >> be used for upload. >> >> Here is a demo Raspberry Pi (just for that purpose) to try it out: >> http://rgb.mjbayer.de/trackdb/ >> (I could also give ssh access to the Raspi if required) >> >> If you run the code in flasks development wsgi server or apache >> mod_wsgi on AMD64, you will not see the issue. >> >> >> Michael >> >> >> >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > > > -- > Scott Werner > scott.werner.vt at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Cwong at nysportssciencelab.com Tue Oct 9 15:05:02 2018 From: Cwong at nysportssciencelab.com (Cal Wong) Date: Tue, 9 Oct 2018 19:05:02 +0000 Subject: [Flask] Security used by Flask mail causing issue with Outlook? Message-ID: Hello Flask team, My name is Calvert and I hope this is the right place to post which I think is a bug (I could be wrong) that prevents our web application to send out emails. Remote Server returned '554 5.6.0 Corrupt message content; STOREDRV.Deliver.Exception:ConversionFailedException; Failed to process message due to a permanent exception with message Content conversion: Corrupt summary TNEF content. ConversionFailedException: Content conversion: Corrupt summary TNEF content. [Stage: PromoteCreateReplay]' Original message headers: This is the error message that I obtained from the Outlook sender after trying to send out an email. Our Office 365 admin contacted Microsoft and Microsoft told him that our web application that uses Flask mail does not meet their security requirements which causes the issue. Our web application works fine before but it failed to work about 2 weeks ago. We did some testing and I will list them out there. 1) We copied an application that sends emails from a Flask tutorial and we successfully sent emails out using the same email that we are using for our web application. 2) We have 3 different folders, the development, staging, and the production. The web app in the development folder runs on local host, staging and production folders are hosted on Heroku. We managed to send out emails by running the web app in the development environment but failed to do so on the staging and production environment. 3) Instead of using Outlook as our sender, we tried using gmail as our sender and our web app was able to send out emails. 4) We tried using another Outlook email as our sender and it fails to send out emails. >From what I have listed, it sounds like our implementation of Flask mail in the web app is faulty but we did not make any changes to the code and we did not change the email content. The web app managed to send out email if Heroku is not involved. In addition with what Microsoft said, I don't know which party went wrong and causes this issue that we are having. The developer that made this web app is no longer working with us and I will try my best to provide anything needed to solve this issue. It would be great if you can confirm that Flask mail is indeed working well with Outlook. Thank you for your time and I appreciate all your response in the future. Regards, Calvert -------------- next part -------------- An HTML attachment was scrubbed... URL: From uditwapt at gmail.com Wed Oct 10 14:21:51 2018 From: uditwapt at gmail.com (Udit Gupta) Date: Wed, 10 Oct 2018 23:51:51 +0530 Subject: [Flask] HacktoberFest Event ! Message-ID: Hi, I would like to invite all coders, Developer and hackers to be part of this event Event Name - HacktoberFest Session Details/Agenda: 09:30 AM - 10:00 AM : Registration 10:00 AM - 10:15 AM : Intro to open source 10:15 AM - 10:30 AM : Intro to Hacktoberfest 10:30 AM - 11:00 AM Workshop: how to contribute to open source 11:00 AM - 11:30 AM 3 Demos (10 minutes for each demos by anyone interested in sharing their open source projects.) 11:30 AM - 12:00 5 min for each community (to Present about community) 12:00 pm - 1:00 pm: Lunch 1:00 pm - 5:30 pm: Start Hacking on HacktoberFest Issue Dev sprint (HackTime) When: Oct 13th, 2018 (Saturday) - 09:30 Am to 06:00 Pm (Please be on time) Where: 91springboard Cec -1 Noida, UP Near Noida Sector -15 How to Reach Venue: - 300 m from Near Noida Sector -15 Google Maps - https://tinyurl.com/ycj7ajx8 RSVP : https://goo.gl/forms/V8WuZK1PpSVg2S8E2 Telegram link for more event - https://t.me/globaltechevents Collaboration with DigitalOcean, TechTalks, TechEvents - Global, GDG New Delhi, Women Who Code Delhi, Women Tech Makers Delhi, Facebook Developer Circle: Delhi, NCR, 101Loop, Startup Delhi If anyone wants to share his opensource project in this event please create the issue at here -- Thanks & Regards Udit Gupta +91-9654161510 -------------- next part -------------- An HTML attachment was scrubbed... URL: From philipp.kraus at tu-clausthal.de Wed Oct 10 17:48:08 2018 From: philipp.kraus at tu-clausthal.de (Philipp Kraus) Date: Wed, 10 Oct 2018 21:48:08 +0000 Subject: [Flask] bind route to object method Message-ID: Hello, I?m new with Flask, but I try to bind a list of objects to routes. Each object has got a part of the url. In general it should be objectlist = getObjects() for o in objectless: app.route( "/api/? + o.name + ?process?, methods=[?POST?], - here I need a call that the process method of o is called and the JSON data from the POST body and url parameters are parsed - ) Each object o has got a method with the signature o.process( body={}, params={} ) and process returns also a dict. So how I can create the JSON deserialization from the POST body, extract the url parameters to a dict and pass all the data to my object method and how can I send the result of the method as JSON structure back? Thanks Phil From rbw at vault13.org Wed Oct 10 19:42:04 2018 From: rbw at vault13.org (Robert Wikman) Date: Thu, 11 Oct 2018 01:42:04 +0200 Subject: [Flask] bind route to object method In-Reply-To: References: Message-ID: Hello, You could create a custom @decorator for your controllers that deserializes `request.get_json()` and parses `request.url`, then passes the results to your `o.process()` method. Check or the Furl and Marshmallow libraries to help out with this. ..or perhaps https://github.com/rbw/flask-journey if you're lazy ;) -- Robert Wikman 0xf6feb506ae5d3762 On Thu, Oct 11, 2018 at 12:19 AM Philipp Kraus < philipp.kraus at tu-clausthal.de> wrote: > Hello, > > I?m new with Flask, but I try to bind a list of objects to routes. Each > object has got a part of the url. In general it should be > > objectlist = getObjects() > for o in objectless: > app.route( "/api/? + o.name + ?process?, methods=[?POST?], - here > I need a call that the process method of o is called and the JSON data from > the POST body and url parameters are parsed - ) > > Each object o has got a method with the signature o.process( body={}, > params={} ) and process returns also a dict. > So how I can create the JSON deserialization from the POST body, extract > the url parameters to a dict and pass all the data to my object method and > how can I send the result of the method as JSON structure back? > > Thanks > > Phil > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From saromba at web.de Thu Oct 11 03:30:07 2018 From: saromba at web.de (Sascha ...) Date: Thu, 11 Oct 2018 09:30:07 +0200 Subject: [Flask] Flask. Application Factory Testing Message-ID: An HTML attachment was scrubbed... URL: From nicolas at lemanchet.fr Thu Oct 11 04:37:29 2018 From: nicolas at lemanchet.fr (Nicolas Le Manchet) Date: Thu, 11 Oct 2018 10:37:29 +0200 Subject: [Flask] Flask. Application Factory Testing In-Reply-To: References: Message-ID: <1539247049.2998559.1538258088.25CB8DFB@webmail.messagingengine.com> Hi, While you have an app factory (create_app), you still define a global app object and use it to create your routes. This defeats a bit the purpose of the app factory and makes writing tests more difficult. One way to solve this problem is by using blueprints, they allow you to decouple the views from the app so you can define your routes without having a concrete app object. You then bind the blueprint with the app inside the create_app function. - http://flask.pocoo.org/docs/1.0/tutorial/views/ - https://github.com/miguelgrinberg/flasky/blob/master/app/__init__.py#L36 -- Nicolas Le Manchet From girish.sridharan at gmail.com Tue Oct 16 06:22:49 2018 From: girish.sridharan at gmail.com (Girish Sridharan) Date: Tue, 16 Oct 2018 15:52:49 +0530 Subject: [Flask] Flask app not loading data - Could it be the sqlalchemy uri step ? Need help Message-ID: Hi all, This is Girish ( 9620249019). Am creating a Flask App. Loading data using SQLALCHEMY using a mysql db. I do not use MySQL db here instead creating a filestorage and a static file load. Creating a flask app with a csv upload. And then analyzing the data using many algorithms. This is not loading. Need help people. Folder structure is such as below: [image: image.png] App code below: # Configuration for File Uploads files = UploadSet('files',ALL) app.config['UPLOADED_FILES_DEST'] = 'static/uploadsDB' configure_uploads(app,files) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///static/uploadsDB/filestorage.db' Warm regards, MS Girish. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 20528 bytes Desc: not available URL: From rajiv.battula at gmail.com Tue Oct 16 14:42:37 2018 From: rajiv.battula at gmail.com (Rajiv Battula) Date: Tue, 16 Oct 2018 11:42:37 -0700 Subject: [Flask] Flask app not loading data - Could it be the sqlalchemy uri step ? Need help In-Reply-To: References: Message-ID: Hey Girish, can you provide more details on what "is not loading"? In the future, provide as much information as possible. A stack trace and a clear description of the error would help with analyzing the issue. Rajiv On Tue, Oct 16, 2018 at 3:23 AM Girish Sridharan wrote: > Hi all, > > This is Girish ( 9620249019). > > Am creating a Flask App. Loading data using SQLALCHEMY using a mysql db. I > do not use MySQL db here instead creating a filestorage and a static file > load. Creating a flask app with a csv upload. And then analyzing the data > using many algorithms. This is not loading. Need help people. > > Folder structure is such as below: > [image: image.png] > App code below: > > # Configuration for File Uploads > > files = UploadSet('files',ALL) > > app.config['UPLOADED_FILES_DEST'] = 'static/uploadsDB' > > configure_uploads(app,files) > > app.config['SQLALCHEMY_DATABASE_URI'] = > 'sqlite:///static/uploadsDB/filestorage.db' > > > Warm regards, > > MS Girish. > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 20528 bytes Desc: not available URL: From girish.sridharan at gmail.com Wed Oct 17 01:01:46 2018 From: girish.sridharan at gmail.com (Girish Sridharan) Date: Wed, 17 Oct 2018 10:31:46 +0530 Subject: [Flask] Flask app not loading data - Could it be the sqlalchemy uri step ? Need help In-Reply-To: References: Message-ID: Hi Rajiv, Am not seeing any data for the analysis. The terminal shell returns an error. The link below has the code and the error. Let me know if you need anything else. I have a stackoverflow link for the same: https://stackoverflow.com/q/52832403/9869430 Thanks, M S Girish. On Wed, Oct 17, 2018 at 12:13 AM Rajiv Battula wrote: > Hey Girish, can you provide more details on what "is not loading"? In the > future, provide as much information as possible. A stack trace and a clear > description of the error would help with analyzing the issue. > > Rajiv > > On Tue, Oct 16, 2018 at 3:23 AM Girish Sridharan < > girish.sridharan at gmail.com> wrote: > >> Hi all, >> >> This is Girish ( 9620249019). >> >> Am creating a Flask App. Loading data using SQLALCHEMY using a mysql db. >> I do not use MySQL db here instead creating a filestorage and a static file >> load. Creating a flask app with a csv upload. And then analyzing the data >> using many algorithms. This is not loading. Need help people. >> >> Folder structure is such as below: >> [image: image.png] >> App code below: >> >> # Configuration for File Uploads >> >> files = UploadSet('files',ALL) >> >> app.config['UPLOADED_FILES_DEST'] = 'static/uploadsDB' >> >> configure_uploads(app,files) >> >> app.config['SQLALCHEMY_DATABASE_URI'] = >> 'sqlite:///static/uploadsDB/filestorage.db' >> >> >> Warm regards, >> >> MS Girish. >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 20528 bytes Desc: not available URL: From david.desurmont at gmail.com Thu Oct 18 12:46:14 2018 From: david.desurmont at gmail.com (david desurmont) Date: Thu, 18 Oct 2018 18:46:14 +0200 Subject: [Flask] How to change the text properties by using flask table Message-ID: Hi all, currently starting on Flask, I need add a dynamic table some data coming from Jira bug tracker. During my first tries, i use Flask Table ( https://flask-table.readthedocs.io/en/stable/). Good plugin to create html table on web page. This work correctly with Jinja template. My question is the following: how to modify the syntax of the string (means Bold, Italic, color and so on) directly by using flask-table properties ? A work around is possible by using the CSS and jinja code, but any anwser is welcome. BR David -------------- next part -------------- An HTML attachment was scrubbed... URL: From riteshn at gmail.com Thu Oct 18 20:03:07 2018 From: riteshn at gmail.com (Ritesh Nadhani) Date: Thu, 18 Oct 2018 17:03:07 -0700 Subject: [Flask] [Flask-SQLAlchemy] Understanding (misunderstanding) SQLALCHEMY_POOL_SIZE Message-ID: Hello We run Flask under uwsgi and 10 workers. Each flask app used to use the default SQLALCHEMY_ECHO_POOL=5. We have a monitoring script that lists down the connections used by each app. Given that we were having 10 worker apps with 5 connections in pool, it used to always show around 40 connections for our uwsgi (which is what we expect). After reading https://brandur.org/postgres-connections, it seems that we might be misusing the pool value completely. Given that at any time a worker can only handle one request which means we only really need one connection for one worker. So I restarted our app with SQLALCHEMY_POOL_SIZE=1 and things are running smoothly but when i still run our script it shows (e.g): 37 [ 5714] /opt/niara/analyzer/bin/uwsgi --master --workers 10 ... I am a bit confused. I was expecting it to be just around 10 (one for each worker). All our request handlers are really synchronous so there should not be any reason to use more than one connection per worker at any given point of time. What am I doing wrong or did I misunderstand things? -- Ritesh From jerry.mccreary at mac.com Fri Oct 19 10:30:51 2018 From: jerry.mccreary at mac.com (Jerry Mccreary) Date: Fri, 19 Oct 2018 10:30:51 -0400 Subject: [Flask] How to change the text properties by using flask table In-Reply-To: References: Message-ID: <4F20CDEA-5D12-42CA-B49C-324645F948A2@mac.com> Add CSS classes would be my first choice. A quick look at Flask-Table examples shows that it is possible to create templates. def single_item(id): element = Item.get_element_by_id(id) # Similarly, normally you would use render_template return '

{}

{}


id: {}'.format( element.name, element.description, element.id) https://github.com/plumdog/flask_table/blob/master/examples/simple_app.py ___________________ Jerry > On Oct 18, 2018, at 12:46 PM, david desurmont wrote: > > Hi all, > > currently starting on Flask, I need add a dynamic table some data coming from Jira bug tracker. > > During my first tries, i use Flask Table (https://flask-table.readthedocs.io/en/stable/ ). Good plugin to create html table on web page. This work correctly with Jinja template. > > My question is the following: how to modify the syntax of the string (means Bold, Italic, color and so on) directly by using flask-table properties ? > > A work around is possible by using the CSS and jinja code, but any anwser is welcome. > > BR > David > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From xpegenaute at gmail.com Thu Oct 25 19:10:25 2018 From: xpegenaute at gmail.com (Xavier Pegenaute) Date: Fri, 26 Oct 2018 01:10:25 +0200 Subject: [Flask] Different Response class per view Message-ID: <47680f83-e9cc-b2b7-8a54-fed3de1cd41b@gmail.com> Hi all, I am trying to code a simple iPXE server which is able to get POST data from the iPXE protocol. Everything is mostly working but I would like that the responses, instead being sent with the default Response class, will be sent with a custom template message and mimetype (CustomResponse class). *Also error messages*. Is that possible ? Best regards, Xavi