There are lots of resources out there you can read about them.

    https://en.wikipedia.org/wiki/Query_string 
<https://en.wikipedia.org/wiki/Query_string>

You might want to find a basic tutorial which explains to you how HTTP requests 
work as they should explain this and much more.

I presume you have gone through the Flask tutorial at least.

> On 10 Sep 2018, at 10:54 pm, Νικόλαος Κούρας <[email protected]> wrote:
> 
> You are right!
> please can you explain to me the difference between and argument and a query 
> parameter?
> 
> Oh my God, i had almost a week this issue which you helped me resolve!
> Thank you !!!
> 
> Στις Δευ, 10 Σεπ 2018 στις 3:11 μ.μ., ο/η Graham Dumpleton 
> <[email protected] <mailto:[email protected]>> έγραψε:
> 
> 
>> On 10 Sep 2018, at 10:08 pm, Νικόλαος Κούρας <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> /home/nikos/wsgi/ i places my apps and static remains at public_html 
>> Configuration now is:
>> DocumentRoot /home/nikos/public_html
>> 
>> <Directory /home/nikos/public_html>
>>     Require all granted
>> </Directory>
>> 
>> <Directory /home/nikos/wsgi>
>>     Require all granted
>> </Directory>
>> 
>> 
>> WSGIDaemonProcess app user=nikos group=nikos home=/home/nikos/public_html
>> WSGIScriptAliasMatch ^/(?!phpmyadmin) /home/nikos/public_html/wsgi/app.py 
>> process-group=app application-group=%{GLOBAL}
>> 
>> WSGIDaemonProcess clientele user=nikos group=nikos 
>> home=/home/nikos/public_html
>> WSGIScriptAlias /clientele /home/nikos/public_html/wsgi/clientele.py 
>> process-group=clientele application-group=%{GLOBAL}
>> 
>> WSGIDaemonProcess downloads user=nikos group=nikos 
>> home=/home/nikos/public_html
>> WSGIScriptAlias /downloads /home/nikos/public_html/wsgi/downloads.py 
>> process-group=downloads application-group=%{GLOBAL}
>> =========================
>> I haven't understood your last mail.
>> @app.route( '/' )
>> @app.route( '/<page>' )
>> def index( page=None ):
>> 
>>      # read environment
>>      pdata = ''
>>      page = request.args.get('page', 'index.html')
> You are overriding the 'page' argument given to the function, which is what 
> you want, with the value of the 'page' query string parameter, which is a 
> completely different thing, but because it isn't passed, falls back to using 
> 'index.html'.
> 
> Comment out the line:
> 
>     page = request.args.get('page', 'index.html')
> 
> Do not use that.
> 
>> 
>> 'page' variable is supposed to hold the URL parameter givn in browser as 
>> 'http://superhost.gr/something <http://superhost.gr/somehting>' no?!
>> It should instead be page = request.args.get(page, 'index.html') you mean?!
>> But why?!
>> 
>> Στις Δευ, 10 Σεπ 2018 στις 2:59 μ.μ., ο/η Graham Dumpleton 
>> <[email protected] <mailto:[email protected]>> έγραψε:
>> Okay, no I clicked as to what you are trying to do.
>> 
>> If you want the path segment, don't use:
>> 
>>     page = request.args.get('page', 'index.html')
>> 
>> Just use the argument given to the function.
>> 
>> When you use request.args you are looking at query string parameters.
>> 
>>     http://superhost.gr?page=xxx.html <http://superhost.gr/?page=xxx.html>
>> 
>> They are different things.
>> 
>>> On 10 Sep 2018, at 9:56 pm, Νικόλαος Κούρας <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> [root@superhost public_html]# curl http://superhost.gr 
>>> <http://superhost.gr/>
>>> index.html
>>> [root@superhost public_html]# curl http://superhost.gr/clientele
>>> index.html <http://superhost.gr/clienteleindex.html>
>>> As it shows even with an argument passed to the domain '/'  page = 
>>> request.args.get('page', 'index.html') returns the latter
>>> 
>>> Also:
>>> application = Flask(__name__)
>>> app = application
>>> app.debug = True
>>> 
>>> Wont display error in browser but still in the error_log text file
>>> 
>>> Στις Δευ, 10 Σεπ 2018 στις 2:47 μ.μ., ο/η Graham Dumpleton 
>>> <[email protected] <mailto:[email protected]>> έγραψε:
>>> It should not be anywhere under /home/nikos/public_html, not even a sub 
>>> directory.
>>> 
>>> So use a parallel directory such as:
>>> 
>>>     /home/nikos/wsgi_apps
>>> 
>>> When testing use:
>>> 
>>>     curl http://superhost.gr/ <http://superhost.gr/>
>>> 
>>> Don't trust your browser, as it may have cached that accessing 
>>> http://superhost.gr/ <http://superhost.gr/> should redirect to 
>>> http://superhost.gr/index.html <http://superhost.gr/index.html>
>>> 
>>> If curl works, you will need to clear your browser cache history for 
>>> http://superhost.gr/ <http://superhost.gr/>
>>> 
>>>> On 10 Sep 2018, at 9:34 pm, Νικόλαος Κούρας <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>> Like this you mean? ialso moved static/ files inside the new wsgi/ 
>>>> directory because even with the directive in the alias 
>>>> home=/home/nikos/public_html templates could not be found
>>>> ====================================
>>>> DocumentRoot /home/nikos/public_html
>>>> 
>>>> <Directory /home/nikos/public_html>
>>>>     Require all granted
>>>> </Directory>
>>>> 
>>>> <Directory /home/nikos/public_html/wsgi>
>>>>     Require all granted
>>>> </Directory>
>>>> 
>>>> 
>>>> WSGIDaemonProcess app user=nikos group=nikos
>>>> WSGIScriptAliasMatch ^/(?!phpmyadmin) /home/nikos/public_html/wsgi/app.py 
>>>> process-group=app application-group=%{GLOBAL}
>>>> 
>>>> WSGIDaemonProcess clientele user=nikos group=nikos
>>>> WSGIScriptAlias /clientele /home/nikos/public_html/wsgi/clientele.py 
>>>> process-group=clientele application-group=%{GLOBAL}
>>>> 
>>>> WSGIDaemonProcess downloads user=nikos group=nikos
>>>> WSGIScriptAlias /downloads /home/nikos/public_html/wsgi/downloads.py 
>>>> process-group=downloads application-group=%{GLOBAL}
>>>> ====================================
>>>> 
>>>> Still the ERROR remains the same after moving to wsgi/
>>>> 
>>>> Στις Δευ, 10 Σεπ 2018 στις 1:47 μ.μ., ο/η Graham Dumpleton 
>>>> <[email protected] <mailto:[email protected]>> έγραψε:
>>>> 
>>>> 
>>>>> On 10 Sep 2018, at 8:34 pm, Νικόλαος Κούρας <[email protected] 
>>>>> <mailto:[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 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 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 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 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