> On 10 Sep 2018, at 8:34 pm, Νικόλαος Κούρας <[email protected]> wrote:
> 
> 1) How do i enable flask so that errors are shown in the browser for m, so i 
> dont have to tail -f error_log all the time?
> 
> When i was using the flask development server i had this
> 
> app.run( host='superhost.gr <http://superhost.gr/>', port=5000, debug=True )
> 
> Now i have commented this out becuas eitsw being run by mod_wsgi and its 
> sending everythign to the error_log text file.

You use:

    app.debug = True

See:

    
http://flask.pocoo.org/docs/1.0/api/?highlight=flask%20debug#flask.Flask.debug 
<http://flask.pocoo.org/docs/1.0/api/?highlight=flask%20debug#flask.Flask.debug>
> 2) Regarding this code which not behalfing as it should
> 
> @app.route( '/<page>' )
> @app.route( '/' )
> def index( page=None ):
> 
>       # read environment
>       page = request.args.get('page', 'index.html')
> 
> When i try via browser:
> 
> 'http://superhost.gr/ <http://superhost.gr/>' page variable equals to 
> 'index.html'
> 'http://superhost.gr/ <http://superhost.gr/>something' page variable still 
> equals to 'index.html'
> 
> How is this possbile under mod_wsgi ?

You shouldn't get index.html in either case if doing things correctly.

The issue may because if I recollect correctly, you had all your .py files for 
the WSGI application under your DocumentRoot directory. You should not do that 
as it can be insecure and wrong configuration elsewhere can lead to someone 
being able to download your source code. Having things in their could also 
cause issues with Apache trying to remap URLs to index files.

Create a directory separate to your DocumentRoot directory and move the .py 
files into it. Then change the WSGIScriptAlias directives to reference the new 
location. You will also need to create a new Directory block for the new 
directory and grant access to being able to serve files from that directory.

> 
> 
> Στις Δευ, 10 Σεπ 2018 στις 5:05 π.μ., ο/η Graham Dumpleton 
> <[email protected] <mailto:[email protected]>> έγραψε:
> 
> 
>> On 10 Sep 2018, at 11:52 am, Νίκος Βέργος <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Graham i know you helped me a lot but my script cannot work if i don;t het 
>> this oe sorted out and i'am trying for hours allready.
>> 
>> Please do help.
>> 
>> 
>> 
>> I have 3 wsgi scripts listening on 3 locations. What i'm trying to run an 
>> wsgi script from within another wsgi script with the following statement.
>> 
>> 
>> 
>> page = 'clientele'
>> pdata = requests.get( 'http://superhost.gr/ <http://superhost.gr/>' + page )
>> pdata = pdata.text + counter
> Have you tried to add print() statements into your code, when it is running 
> and what variables are at each point? If you use print(), what you print will 
> appear in the Apache error log so you can see it. As per example in requests 
> docs at:
> 
> http://docs.python-requests.org/en/master/ 
> <http://docs.python-requests.org/en/master/>
> 
> you don't even appear to check the response status code. Check such things, 
> print out the values and see what it is getting.
>> page = the location of another wsgi app.
>> 
>> The error i'am getting when for i.e i try to load 
>> http://superhost.gr/clientele <http://superhost.gr/clientele>
>> 
>> mod_wsgi (pid=7152): Exception occurred processing WSGI script 
>> '/home/nikos/public_html/app.py' 
>> OSError: Apache/mod_wsgi failed to write response data: Broken pipe. 
> This specific message from mod_wsgi indicates that the HTTP client making the 
> request dropped the connection before the server could write the response.
> 
> So possibly an error is occurring in app.py if that is what is calling it.
> 
> Have you enabled Flask debug so that errors are shown in the browser for you. 
> If you don't, Flask will just return a 500 error and may not actually log 
> anything about the error. You may need to set up Flask logging so that it 
> logs details of exceptions to the error log.
> 
> http://flask.pocoo.org/docs/1.0/logging/#logging 
> <http://flask.pocoo.org/docs/1.0/logging/#logging>The other script by itself 
> executes normally but NOT from within my app.py script.
>> 
>> Any ideas on how to execute a wsgi app (b) from within a wsgi app(a) and 
>> store the response as html data?
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "modwsgi" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] 
>> <mailto:[email protected]>.
>> To post to this group, send email to [email protected] 
>> <mailto:[email protected]>.
>> Visit this group at https://groups.google.com/group/modwsgi 
>> <https://groups.google.com/group/modwsgi>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "modwsgi" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/modwsgi/lZDr6zKcyUg/unsubscribe 
> <https://groups.google.com/d/topic/modwsgi/lZDr6zKcyUg/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to