librelist archives

« back to archive

Flask, mod_wsgi and apache issues

Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-07 @ 19:10
Hi all,

I would need some help to get a basic "Hello World" running on a remote
server:  https://github.com/mitsuhiko/flask/issues/825

I have been trying to get this work for about 3-4 days in a full-time job,
and I am getting frustrated about it. Do you see any obvious mistake? Any
useful help is appreciated. Thank you in advance.

-- Laszlo

Re: [flask] Flask, mod_wsgi and apache issues

From:
Ryan O'Donnell
Date:
2013-08-07 @ 19:45
Seems to be that you're defining your application as: foo.py, however,
you're trying to include "foo.wsgi."

Do this to give yourself an idea of how namespace and imports work within
Python:

Create a file (foo.wsgi) and put the following text (from the
documentation) in your file: from yourapplication import app as application

However, please be aware that... "yourapplication" will have to be "foo"
and "app" in your case will have to be "application"

In this instance, you can just do so:

"form foo import application"



Also, please be careful where you're putting these files! Seems you're not
including them in the correct space.


I can't help you with Apache Virtual Hosts, as I don't have any experience
with those. Apache usually has good docs from my understanding:
http://httpd.apache.org/docs/2.2/vhosts/




On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:

> Hi all,
>
> I would need some help to get a basic "Hello World" running on a remote
> server:  https://github.com/mitsuhiko/flask/issues/825
>
> I have been trying to get this work for about 3-4 days in a full-time job,
> and I am getting frustrated about it. Do you see any obvious mistake? Any
> useful help is appreciated. Thank you in advance.
>
> -- Laszlo
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-07 @ 19:51
Hi Ryan,

I will assume you meant "from" instead of "form", but if you double check
the github issue, I have been using it so.

-- Laszlo

On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:

> Seems to be that you're defining your application as: foo.py, however,
> you're trying to include "foo.wsgi."
>
> Do this to give yourself an idea of how namespace and imports work within
> Python:
>
> Create a file (foo.wsgi) and put the following text (from the
> documentation) in your file: from yourapplication import app as
> application
>
> However, please be aware that... "yourapplication" will have to be "foo"
> and "app" in your case will have to be "application"
>
> In this instance, you can just do so:
>
> "form foo import application"
>
>
>
> Also, please be careful where you're putting these files! Seems you're not
> including them in the correct space.
>
>
> I can't help you with Apache Virtual Hosts, as I don't have any experience
> with those. Apache usually has good docs from my understanding:
> http://httpd.apache.org/docs/2.2/vhosts/
>
>
>
>
> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> Hi all,
>>
>> I would need some help to get a basic "Hello World" running on a remote
>> server:  https://github.com/mitsuhiko/flask/issues/825
>>
>> I have been trying to get this work for about 3-4 days in a full-time
>> job, and I am getting frustrated about it. Do you see any obvious mistake?
>> Any useful help is appreciated. Thank you in advance.
>>
>> -- Laszlo
>>
>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Ryan O'Donnell
Date:
2013-08-07 @ 19:56
I read over the Github issue.

Can you give me your directory listing? All files, and contents, please.
Can you also copy me on where you include the file in your virtual hosts
config?

Ryan


On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:

> Hi Ryan,
>
> I will assume you meant "from" instead of "form", but if you double check
> the github issue, I have been using it so.
>
> -- Laszlo
>
> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>
>> Seems to be that you're defining your application as: foo.py, however,
>> you're trying to include "foo.wsgi."
>>
>> Do this to give yourself an idea of how namespace and imports work within
>> Python:
>>
>> Create a file (foo.wsgi) and put the following text (from the
>> documentation) in your file: from yourapplication import app as
>> application
>>
>> However, please be aware that... "yourapplication" will have to be "foo"
>> and "app" in your case will have to be "application"
>>
>> In this instance, you can just do so:
>>
>> "form foo import application"
>>
>>
>>
>> Also, please be careful where you're putting these files! Seems you're
>> not including them in the correct space.
>>
>>
>> I can't help you with Apache Virtual Hosts, as I don't have any
>> experience with those. Apache usually has good docs from my understanding:
>> http://httpd.apache.org/docs/2.2/vhosts/
>>
>>
>>
>>
>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>
>>> Hi all,
>>>
>>> I would need some help to get a basic "Hello World" running on a remote
>>> server:  https://github.com/mitsuhiko/flask/issues/825
>>>
>>> I have been trying to get this work for about 3-4 days in a full-time
>>> job, and I am getting frustrated about it. Do you see any obvious mistake?
>>> Any useful help is appreciated. Thank you in advance.
>>>
>>> -- Laszlo
>>>
>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-07 @ 20:05
Those are mentioned on github. What are you missing from there? There is
the directory listing there, and even the apache config.


On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:

> I read over the Github issue.
>
> Can you give me your directory listing? All files, and contents, please.
> Can you also copy me on where you include the file in your virtual hosts
> config?
>
> Ryan
>
>
> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> Hi Ryan,
>>
>> I will assume you meant "from" instead of "form", but if you double check
>> the github issue, I have been using it so.
>>
>> -- Laszlo
>>
>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>
>>> Seems to be that you're defining your application as: foo.py, however,
>>> you're trying to include "foo.wsgi."
>>>
>>> Do this to give yourself an idea of how namespace and imports work
>>> within Python:
>>>
>>> Create a file (foo.wsgi) and put the following text (from the
>>> documentation) in your file: from yourapplication import app as
>>> application < /div>
>>>
>>> However, please be aware that... "yourapplication" will have to be "foo"
>>> and "app" in your case will have to be "application"
>>>
>>> In this instance, you can just do so:
>>>
>>> "form foo import application"
>>>
>>>
>>>
>>> Also, please be careful where you're putting these files! Seems you're
>>> not including them in the correct space.
>>>
>>>
>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>> experience with those. Apache usually has good docs from my understanding:
>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>
>>>
>>>
>>>
>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I would need some help to get a basic "Hello World" running on a remote
>>>> server:  https://github.com/mitsuhiko/flask/issues/825
>>>>
>>>> I have been trying to get this work for about 3-4 days in a full-time
>>>> job, and I am getting frustrated about it. Do you see any obvious mistake?
>>>> Any useful help is appreciated. Thank you in advance.
>>>>
>>>> -- Laszlo
>>>>
>>>
>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Ryan O'Donnell
Date:
2013-08-07 @ 20:29
The configuration you list in Github is absolutely incorrect, if that's
what you're using. It has already been explained to you why it isn't
correct.

If you copy me on your latest, I can attempt to help further, otherwise I
would try to read over the suggestions that others have made to you.

Regards,


On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:

> Those are mentioned on github. What are you missing from there? There is
> the directory listing there, and even the apache config.
>
>
> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>
>> I read over the Github issue.
>>
>> Can you give me your directory listing? All files, and contents, please.
>> Can you also copy me on where you include the file in your virtual hosts
>> config?
>>
>> Ryan
>>
>>
>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>
>>> Hi Ryan,
>>>
>>> I will assume you meant "from" instead of "form", but if you double
>>> check the github issue, I have been using it so.
>>>
>>> -- Laszlo
>>>
>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>>
>>>> Seems to be that you're defining your application as: foo.py, however,
>>>> you're trying to include "foo.wsgi."
>>>>
>>>> Do this to give yourself an idea of how namespace and imports work
>>>> within Python:
>>>>
>>>> Create a file (foo.wsgi) and put the following text (from the
>>>> documentation) in your file: from yourapplication import app as
>>>> application < /div>
>>>>
>>>> However, please be aware that... "yourapplication" will have to be
>>>> "foo" and "app" in your case will have to be "application"
>>>>
>>>> In this instance, you can just do so:
>>>>
>>>> "form foo import application"
>>>>
>>>>
>>>>
>>>> Also, please be careful where you're putting these files! Seems you're
>>>> not including them in the correct space.
>>>>
>>>>
>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>> experience with those. Apache usually has good docs from my understanding:
>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I would need some help to get a basic "Hello World" running on a
>>>>> remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>
>>>>> I have been trying to get this work for about 3-4 days in a full-time
>>>>> job, and I am getting frustrated about it. Do you see any obvious mistake?
>>>>> Any useful help is appreciated. Thank you in advance.
>>>>>
>>>>> -- Laszlo
>>>>>
>>>>
>>>>
>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-07 @ 20:36
What is incorrect? I have not seen much suggestions to be honest other than
complaints about a warning, which is just as its name says warning, not
critical.

But even then, it is fixed by putting :80 in there as mentioned.
Unfortunately, I cannot paste the slightly changed version right now as I
am at home, and not at the company, but it is pretty much a ":80" for the
virtual host to avoid the otherwise insignificant warnings.


On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:

> The configuration you list in Github is absolutely incorrect, if that's
> what you're using. It has already been explained to you why it isn't
> correct.
>
> If you copy me on your latest, I can attempt to help further, otherwise I
> would try to read over the suggestions that others have made to you.
>
> Regards,
>
>
> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> Those are mentioned on github. What are you missing from there? There is
>> the directory listing there, and even the apache config.
>>
>>
>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>
>>> I read over the Github issue.
>>>
>>> Can you give me your directory listing? All files, and contents, please.
>>> Can you also copy me on where you include the file in your virtual hosts
>>> config?
>>>
>>> Ryan
>>>
>>>
>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>
>>>> Hi Ryan,
>>>>
>>>> I will assume you meant "from" instead of "form", but if you double
>>>> check the github issue, I have been using it so.
>>>>
>>>> -- Laszlo
>>>>
>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <odonnellryanc@gmail.com
>>>> > wrote:
>>>>
>>>>> Seems to be that you're defining your application as: foo.py, however,
>>>>> you're trying to include "foo.wsgi."
>>>>>
>>>>> Do this to give yourself an idea of how namespace and imports work
>>>>> within Python:
>>>>>
>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>> documentation) in your file: from yourapplication import app as applic
>>>>> ation < /div>
>>>>>
>>>>> However, please be aware that... "yourapplication" will have to be
>>>>> "foo" and "app" in your case will have to be "application"
>>>>>
>>>>> In this instance, you can just do so:
>>>>>
>>>>> "form foo import application"
>>>>>
>>>>>
>>>>>
>>>>> Also, please be careful where you're putting these files! Seems you're
>>>>> not including them in the correct space.
>>>>>
>>>>>
>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>> experience with those. Apache usually has good docs from my understanding:
>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I would need some help to get a basic "Hello World" running on a
>>>>>> remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>>
>>>>>> I have been trying to get this work for about 3-4 days in a full-time
>>>>>> job, and I am getting frustrated about it. Do you see any obvious mistake?
>>>>>> Any useful help is appreciated. Thank you in advance.
>>>>>>
>>>>>> -- Laszlo
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Ryan O'Donnell
Date:
2013-08-07 @ 20:43
So your current problem is? The port issue?
On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:

> What is incorrect? I have not seen much suggestions to be honest other
> than complaints about a warning, which is just as its name says warning,
> not critical.
>
> But even then, it is fixed by putting :80 in there as mentioned.
> Unfortunately, I cannot paste the slightly changed version right now as I
> am at home, and not at the company, but it is pretty much a ":80" for the
> virtual host to avoid the otherwise insignificant warnings.
>
>
> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>
>> The configuration you list in Github is absolutely incorrect, if that's
>> what you're using. It has already been explained to you why it isn't
>> correct.
>>
>> If you copy me on your latest, I can attempt to help further, otherwise I
>> would try to read over the suggestions that others have made to you.
>>
>> Regards,
>>
>>
>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>
>>> Those are mentioned on github. What are you missing from there? There is
>>> the directory listing there, and even the apache config.
>>>
>>>
>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>>
>>>> I read over the Github issue.
>>>>
>>>> Can you give me your directory listing? All files, and contents,
>>>> please. Can you also copy me on where you include the file in your virtual
>>>> hosts config?
>>>>
>>>> Ryan
>>>>
>>>>
>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>
>>>>> Hi Ryan,
>>>>>
>>>>> I will assume you meant "from" instead of "form", but if you double
>>>>> check the github issue, I have been using it so.
>>>>>
>>>>> -- Laszlo
>>>>>
>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>> odonnellryanc@gmail.com> wrote:
>>>>>
>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>
>>>>>> Do this to give yourself an idea of how namespace and imports work
>>>>>> within Python:
>>>>>>
>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>> documentation) in your file: from yourapplication import app as applic
>>>>>> ation < /div>
>>>>>>
>>>>>> However, please be aware that... "yourapplication" will have to be
>>>>>> "foo" and "app" in your case will have to be "application"
>>>>>>
>>>>>> In this instance, you can just do so:
>>>>>>
>>>>>> "form foo import application"
>>>>>>
>>>>>>
>>>>>>
>>>>>> Also, please be careful where you're putting these files! Seems
>>>>>> you're not including them in the correct space.
>>>>>>
>>>>>>
>>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>>> experience with those. Apache usually has good docs from my understanding:
>>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I would need some help to get a basic "Hello World" running on a
>>>>>>> remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>>>
>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>> full-time job, and I am getting frustrated about it. Do you see 
any obvious
>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>
>>>>>>> -- Laszlo
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-07 @ 20:47
Current problem is that the python script is not run for some reason.


On Wed, Aug 7, 2013 at 9:43 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:

> So your current problem is? The port issue?
> On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:
>
>> What is incorrect? I have not seen much suggestions to be honest other
>> than complaints about a warning, which is just as its name says warning,
>> not critical.
>>
>> But even then, it is fixed by putting :80 in there as mentioned.
>> Unfortunately, I cannot paste the slightly changed version right now as I
>> am at home, and not at the company, but it is pretty much a ":80" for the
>> virtual host to avoid the otherwise insignificant warnings.
>>
>>
>> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>
>>> The configuration you list in Github is absolutely incorrect, if that's
>>> what you're using. It has already been explained to you why it isn't
>>> correct.
>>>
>>> If you copy me on your latest, I can attempt to help further, otherwise
>>> I would try to read over the suggestions that others have made to you.
>>>
>>> Regards,
>>>
>>>
>>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>
>>>> Those are mentioned on github. What are you missing from there? There
>>>> is the directory listing there, and even the apache config.
>>>>
>>>>
>>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <odonnellryanc@gmail.com
>>>> > wrote:
>>>>
>>>>> I read over the Github issue.
>>>>>
>>>>> Can you give me your directory listing? All files, and contents,
>>>>> please. Can you also copy me on where you include the file in your virtual
>>>>> hosts config?
>>>>>
>>>>> Ryan
>>>>>
>>>>>
>>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>
>>>>>> Hi Ryan,
>>>>>>
>>>>>> I will assume you meant "from" instead of "form", but if you double
>>>>>> check the github issue, I have been using it so.
>>>>>>
>>>>>> -- Laszlo
>>>>>>
>>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>
>>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>>
>>>>>>> Do this to give yourself an idea of how namespace and imports work
>>>>>>> within Python:
>>>>>>>
>>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>>> documentation) in your file: from yourapplication import app as applic
>>>>>>> ation < /div>
>>>>>>>
>>>>>>> However, please be aware that... "yourapplication" will have to be
>>>>>>> "foo" and "app" in your case will have to be "application"
>>>>>>>
>>>>>>> In this instance, you can just do so:
>>>>>>>
>>>>>>> "form foo import application"
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Also, please be careful where you're putting these files! Seems
>>>>>>> you're not including them in the correct space.
>>>>>>>
>>>>>>>
>>>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>>>> experience with those. Apache usually has good docs from my understanding:
>>>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> I would need some help to get a basic "Hello World" running on a
>>>>>>>> remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>>>>
>>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>>> full-time job, and I am getting frustrated about it. Do you see 
any obvious
>>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>>
>>>>>>>> -- Laszlo
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-08 @ 10:53
I just gave a try to CGI as well. Any clue?

#!/usr/bin/python

from wsgiref.handlers import CGIHandler

from flask import Flask
application = Flask(__name__)

@application.route('/baz')
def hello_world():
        return 'Hello World!'

if __name__ == '__main__':
        application.run()

CGIHandler().run(application)


=====================================================================================================================

[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]  * Running on
http://127.0.0.1:5000/
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Traceback (most
recent call last):
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/cgi-bin/foo.cgi", line 13, in <module>
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
application.run()
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/dist-packages/flask/app.py", line 703, in run
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] run_simple(host,
port, self, **options)
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 614, in
run_simple
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     inner()
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 596, in inner
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
passthrough_errors, ssl_context).serve_forever()
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 405, in
make_server
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
passthrough_errors, ssl_context)
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 331, in
__init__
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
HTTPServer.__init__(self, (host, int(port)), handler)
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/SocketServer.py", line 408, in __init__
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
self.server_bind()
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
SocketServer.TCPServer.server_bind(self)
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
self.socket.bind(self.server_address)
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
"/usr/lib/python2.7/socket.py", line 224, in meth
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     return
getattr(self._sock,name)(*args)
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] socket.error:
[Errno 98] Address already in use
[Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Premature end of
script headers: foo.cgi


On Wed, Aug 7, 2013 at 9:47 PM, Laszlo Papp <lpapp@kde.org> wrote:

> Current problem is that the python script is not run for some reason.
>
>
> On Wed, Aug 7, 2013 at 9:43 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>
>> So your current problem is? The port issue?
>> On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:
>>
>>> What is incorrect? I have not seen much suggestions to be honest other
>>> than complaints about a warning, which is just as its name says warning,
>>> not critical.
>>>
>>> But even then, it is fixed by putting :80 in there as mentioned.
>>> Unfortunately, I cannot paste the slightly changed version right now as I
>>> am at home, and not at the company, but it is pretty much a ":80" for the
>>> virtual host to avoid the otherwise insignificant warnings.
>>>
>>>
>>> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>>
>>>> The configuration you list in Github is absolutely incorrect, if that's
>>>> what you're using. It has already been explained to you why it isn't
>>>> correct.
>>>>
>>>> If you copy me on your latest, I can attempt to help further, otherwise
>>>> I would try to read over the suggestions that others have made to you.
>>>>
>>>> Regards,
>>>>
>>>>
>>>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>
>>>>> Those are mentioned on github. What are you missing from there? There
>>>>> is the directory listing there, and even the apache config.
>>>>>
>>>>>
>>>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <
>>>>> odonnellryanc@gmail.com> wrote:
>>>>>
>>>>>> I read over the Github issue.
>>>>>>
>>>>>> Can you give me your directory listing? All files, and contents,
>>>>>> please. Can you also copy me on where you include the file in your virtual
>>>>>> hosts config?
>>>>>>
>>>>>> Ryan
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>
>>>>>>> Hi Ryan,
>>>>>>>
>>>>>>> I will assume you meant "from" instead of "form", but if you double
>>>>>>> check the github issue, I have been using it so.
>>>>>>>
>>>>>>> -- Laszlo
>>>>>>>
>>>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>
>>>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>>>
>>>>>>>> Do this to give yourself an idea of how namespace and imports work
>>>>>>>> within Python:
>>>>>>>>
>>>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>>>> documentation) in your file: from yourapplication import app as applic
>>>>>>>> ation < /div>
>>>>>>>>
>>>>>>>> However, please be aware that... "yourapplication" will have to be
>>>>>>>> "foo" and "app" in your case will have to be "application"
>>>>>>>>
>>>>>>>> In this instance, you can just do so:
>>>>>>>>
>>>>>>>> "form foo import application"
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Also, please be careful where you're putting these files! Seems
>>>>>>>> you're not including them in the correct space.
>>>>>>>>
>>>>>>>>
>>>>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>>>>> experience with those. Apache usually has good docs from my 
understanding:
>>>>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> I would need some help to get a basic "Hello World" running on a
>>>>>>>>> remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>>>>>
>>>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>>>> full-time job, and I am getting frustrated about it. Do you see 
any obvious
>>>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>>>
>>>>>>>>> -- Laszlo
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-08 @ 11:12
OK, got cgi working... so that I can say the foo.py is a good hello world
content. So, the next question would be why the wsgi does not.


On Thu, Aug 8, 2013 at 11:53 AM, Laszlo Papp <lpapp@kde.org> wrote:

> I just gave a try to CGI as well. Any clue?
>
> #!/usr/bin/python
>
> from wsgiref.handlers import CGIHandler
>
> from flask import Flask
> application = Flask(__name__)
>
> @application.route('/baz')
> def hello_world():
>         return 'Hello World!'
>
> if __name__ == '__main__':
>         application.run()
>
> CGIHandler().run(application)
>
>
> 
=====================================================================================================================
>
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]  * Running on
> http://127.0.0.1:5000/
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Traceback (most
> recent call last):
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/cgi-bin/foo.cgi", line 13, in <module>
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> application.run()
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/dist-packages/flask/app.py", line 703, in run
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] run_simple(host,
> port, self, **options)
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 614, in
> run_simple
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     inner()
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 596, in inner
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> passthrough_errors, ssl_context).serve_forever()
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 405, in
> make_server
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> passthrough_errors, ssl_context)
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 331, in
> __init__
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> HTTPServer.__init__(self, (host, int(port)), handler)
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> self.server_bind()
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> SocketServer.TCPServer.server_bind(self)
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
> self.socket.bind(self.server_address)
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
> "/usr/lib/python2.7/socket.py", line 224, in meth
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     return
> getattr(self._sock,name)(*args)
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] socket.error:
> [Errno 98] Address already in use
> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Premature end of
> script headers: foo.cgi
>
>
> On Wed, Aug 7, 2013 at 9:47 PM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> Current problem is that the python script is not run for some reason.
>>
>>
>> On Wed, Aug 7, 2013 at 9:43 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>
>>> So your current problem is? The port issue?
>>> On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:
>>>
>>>> What is incorrect? I have not seen much suggestions to be honest other
>>>> than complaints about a warning, which is just as its name says warning,
>>>> not critical.
>>>>
>>>> But even then, it is fixed by putting :80 in there as mentioned.
>>>> Unfortunately, I cannot paste the slightly changed version right now as I
>>>> am at home, and not at the company, but it is pretty much a ":80" for the
>>>> virtual host to avoid the otherwise insignificant warnings.
>>>>
>>>>
>>>> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <odonnellryanc@gmail.com
>>>> > wrote:
>>>>
>>>>> The configuration you list in Github is absolutely incorrect, if
>>>>> that's what you're using. It has already been explained to you why it isn't
>>>>> correct.
>>>>>
>>>>> If you copy me on your latest, I can attempt to help further,
>>>>> otherwise I would try to read over the suggestions that others have made to
>>>>> you.
>>>>>
>>>>> Regards,
>>>>>
>>>>>
>>>>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>
>>>>>> Those are mentioned on github. What are you missing from there? There
>>>>>> is the directory listing there, and even the apache config.
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <
>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>
>>>>>>> I read over the Github issue.
>>>>>>>
>>>>>>> Can you give me your directory listing? All files, and contents,
>>>>>>> please. Can you also copy me on where you include the file in your virtual
>>>>>>> hosts config?
>>>>>>>
>>>>>>> Ryan
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>
>>>>>>>> Hi Ryan,
>>>>>>>>
>>>>>>>> I will assume you meant "from" instead of "form", but if you double
>>>>>>>> check the github issue, I have been using it so.
>>>>>>>>
>>>>>>>> -- Laszlo
>>>>>>>>
>>>>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>>>>
>>>>>>>>> Do this to give yourself an idea of how namespace and imports work
>>>>>>>>> within Python:
>>>>>>>>>
>>>>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>>>>> documentation) in your file: from yourapplication import app as applic
>>>>>>>>> ation < /div>
>>>>>>>>>
>>>>>>>>> However, please be aware that... "yourapplication" will have to be
>>>>>>>>> "foo" and "app" in your case will have to be "application"
>>>>>>>>>
>>>>>>>>> In this instance, you can just do so:
>>>>>>>>>
>>>>>>>>> "form foo import application"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Also, please be careful where you're putting these files! Seems
>>>>>>>>> you're not including them in the correct space.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>>>>>> experience with those. Apache usually has good docs from my 
understanding:
>>>>>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>>>
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> I would need some help to get a basic "Hello World" running on a
>>>>>>>>>> remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>>>>>>
>>>>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>>>>> full-time job, and I am getting frustrated about it. Do you see
any obvious
>>>>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>>>>
>>>>>>>>>> -- Laszlo
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-08 @ 11:46
Just to be explicitly clearer:

"[Thu Aug 08 12:23:35 2013] [error] [client 192.168.3.182] File does not
exist: /var/www/bar" is the error message when trying to access the
http://A.B.C.D/bar url mapped to the hello world python function.

Why it looking for such a physical directory when it should just be a
virtual url binding? I am personally not sure at this point if it is a
mod_wsgi or apache bug, or just a documentation/faq. Here is the 001-foo
sites-enabled Virtual Host config again, just in case:

<VirtualHost *:80>
    ServerName foo.com

    # WSGIDaemonProcess foo user=http group=http threads=5
    WSGIScriptAlias / /var/www/foo.wsgi

    <Directory /var/www/foo>
        WSGIProcessGroup foo
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>



On Thu, Aug 8, 2013 at 12:12 PM, Laszlo Papp <lpapp@kde.org> wrote:

> OK, got cgi working... so that I can say the foo.py is a good hello world
> content. So, the next question would be why the wsgi does not.
>
>
> On Thu, Aug 8, 2013 at 11:53 AM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> I just gave a try to CGI as well. Any clue?
>>
>> #!/usr/bin/python
>>
>> from wsgiref.handlers import CGIHandler
>>
>> from flask import Flask
>> application = Flask(__name__)
>>
>> @application.route('/baz')
>> def hello_world():
>>         return 'Hello World!'
>>
>> if __name__ == '__main__':
>>         application.run()
>>
>> CGIHandler().run(application)
>>
>>
>> 
=====================================================================================================================
>>
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]  * Running on
>> http://127.0.0.1:5000/
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Traceback (most
>> recent call last):
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/cgi-bin/foo.cgi", line 13, in <module>
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> application.run()
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/dist-packages/flask/app.py", line 703, in run
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> run_simple(host, port, self, **options)
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 614, in
>> run_simple
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     inner()
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 596, in inner
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> passthrough_errors, ssl_context).serve_forever()
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 405, in
>> make_server
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> passthrough_errors, ssl_context)
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 331, in
>> __init__
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> HTTPServer.__init__(self, (host, int(port)), handler)
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> self.server_bind()
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> SocketServer.TCPServer.server_bind(self)
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>> self.socket.bind(self.server_address)
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>> "/usr/lib/python2.7/socket.py", line 224, in meth
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     return
>> getattr(self._sock,name)(*args)
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] socket.error:
>> [Errno 98] Address already in use
>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Premature end
>> of script headers: foo.cgi
>>
>>
>> On Wed, Aug 7, 2013 at 9:47 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>
>>> Current problem is that the python script is not run for some reason.
>>>
>>>
>>> On Wed, Aug 7, 2013 at 9:43 PM, Ryan O'Donnell <odonnellryanc@gmail.com>wrote:
>>>
>>>> So your current problem is? The port issue?
>>>> On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:
>>>>
>>>>> What is incorrect? I have not seen much suggestions to be honest other
>>>>> than complaints about a warning, which is just as its name says warning,
>>>>> not critical.
>>>>>
>>>>> But even then, it is fixed by putting :80 in there as mentioned.
>>>>> Unfortunately, I cannot paste the slightly changed version right now as I
>>>>> am at home, and not at the company, but it is pretty much a ":80" for the
>>>>> virtual host to avoid the otherwise insignificant warnings.
>>>>>
>>>>>
>>>>> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <
>>>>> odonnellryanc@gmail.com> wrote:
>>>>>
>>>>>> The configuration you list in Github is absolutely incorrect, if
>>>>>> that's what you're using. It has already been explained to you why it isn't
>>>>>> correct.
>>>>>>
>>>>>> If you copy me on your latest, I can attempt to help further,
>>>>>> otherwise I would try to read over the suggestions that others have made to
>>>>>> you.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>
>>>>>>> Those are mentioned on github. What are you missing from there?
>>>>>>> There is the directory listing there, and even the apache config.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <
>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>
>>>>>>>> I read over the Github issue.
>>>>>>>>
>>>>>>>> Can you give me your directory listing? All files, and contents,
>>>>>>>> please. Can you also copy me on where you include the file in 
your virtual
>>>>>>>> hosts config?
>>>>>>>>
>>>>>>>> Ryan
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>>
>>>>>>>>> Hi Ryan,
>>>>>>>>>
>>>>>>>>> I will assume you meant "from" instead of "form", but if you
>>>>>>>>> double check the github issue, I have been using it so.
>>>>>>>>>
>>>>>>>>> -- Laszlo
>>>>>>>>>
>>>>>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>>>>>
>>>>>>>>>> Do this to give yourself an idea of how namespace and imports
>>>>>>>>>> work within Python:
>>>>>>>>>>
>>>>>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>>>>>> documentation) in your file: from yourapplication import app as applic
>>>>>>>>>> ation < /div>
>>>>>>>>>>
>>>>>>>>>> However, please be aware that... "yourapplication" will have to
>>>>>>>>>> be "foo" and "app" in your case will have to be "application"
>>>>>>>>>>
>>>>>>>>>> In this instance, you can just do so:
>>>>>>>>>>
>>>>>>>>>> "form foo import application"
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Also, please be careful where you're putting these files! Seems
>>>>>>>>>> you're not including them in the correct space.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>>>>>>> experience with those. Apache usually has good docs from my 
understanding:
>>>>>>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org>wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi all,
>>>>>>>>>>>
>>>>>>>>>>> I would need some help to get a basic "Hello World" running on a
>>>>>>>>>>> remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>>>>>>>
>>>>>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>>>>>> full-time job, and I am getting frustrated about it. Do you 
see any obvious
>>>>>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>>>>>
>>>>>>>>>>> -- Laszlo
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-08 @ 12:56
The wsgi module seems to be loaded, too.

sudo apachectl -M | grep wsgi_module
Syntax OK
 wsgi_module (shared)


On Thu, Aug 8, 2013 at 12:46 PM, Laszlo Papp <lpapp@kde.org> wrote:

> Just to be explicitly clearer:
>
> "[Thu Aug 08 12:23:35 2013] [error] [client 192.168.3.182] File does not
> exist: /var/www/bar" is the error message when trying to access the
> http://A.B.C.D/bar url mapped to the hello world python function.
>
> Why it looking for such a physical directory when it should just be a
> virtual url binding? I am personally not sure at this point if it is a
> mod_wsgi or apache bug, or just a documentation/faq. Here is the 001-foo
> sites-enabled Virtual Host config again, just in case:
>
> <VirtualHost *:80>
>     ServerName foo.com
>
>     # WSGIDaemonProcess foo user=http group=http threads=5
>     WSGIScriptAlias / /var/www/foo.wsgi
>
>     <Directory /var/www/foo>
>         WSGIProcessGroup foo
>         WSGIApplicationGroup %{GLOBAL}
>         Order deny,allow
>         Allow from all
>     </Directory>
> </VirtualHost>
>
>
>
> On Thu, Aug 8, 2013 at 12:12 PM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> OK, got cgi working... so that I can say the foo.py is a good hello world
>> content. So, the next question would be why the wsgi does not.
>>
>>
>> On Thu, Aug 8, 2013 at 11:53 AM, Laszlo Papp <lpapp@kde.org> wrote:
>>
>>> I just gave a try to CGI as well. Any clue?
>>>
>>> #!/usr/bin/python
>>>
>>> from wsgiref.handlers import CGIHandler
>>>
>>> from flask import Flask
>>> application = Flask(__name__)
>>>
>>> @application.route('/baz')
>>> def hello_world():
>>>         return 'Hello World!'
>>>
>>> if __name__ == '__main__':
>>>         application.run()
>>>
>>> CGIHandler().run(application)
>>>
>>>
>>> 
=====================================================================================================================
>>>
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]  * Running on
>>> http://127.0.0.1:5000/
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Traceback
>>> (most recent call last):
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/cgi-bin/foo.cgi", line 13, in <module>
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> application.run()
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/dist-packages/flask/app.py", line 703, in run
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> run_simple(host, port, self, **options)
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 614, in
>>> run_simple
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     inner()
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 596, in inner
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> passthrough_errors, ssl_context).serve_forever()
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 405, in
>>> make_server
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> passthrough_errors, ssl_context)
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 331, in
>>> __init__
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> HTTPServer.__init__(self, (host, int(port)), handler)
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> self.server_bind()
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> SocketServer.TCPServer.server_bind(self)
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>> self.socket.bind(self.server_address)
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>> "/usr/lib/python2.7/socket.py", line 224, in meth
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     return
>>> getattr(self._sock,name)(*args)
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] socket.error:
>>> [Errno 98] Address already in use
>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Premature end
>>> of script headers: foo.cgi
>>>
>>>
>>> On Wed, Aug 7, 2013 at 9:47 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>
>>>> Current problem is that the python script is not run for some reason.
>>>>
>>>>
>>>> On Wed, Aug 7, 2013 at 9:43 PM, Ryan O'Donnell <odonnellryanc@gmail.com
>>>> > wrote:
>>>>
>>>>> So your current problem is? The port issue?
>>>>> On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:
>>>>>
>>>>>> What is incorrect? I have not seen much suggestions to be honest
>>>>>> other than complaints about a warning, which is just as its name says
>>>>>> warning, not critical.
>>>>>>
>>>>>> But even then, it is fixed by putting :80 in there as mentioned.
>>>>>> Unfortunately, I cannot paste the slightly changed version right now as I
>>>>>> am at home, and not at the company, but it is pretty much a ":80" for the
>>>>>> virtual host to avoid the otherwise insignificant warnings.
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <
>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>
>>>>>>> The configuration you list in Github is absolutely incorrect, if
>>>>>>> that's what you're using. It has already been explained to you why
it isn't
>>>>>>> correct.
>>>>>>>
>>>>>>> If you copy me on your latest, I can attempt to help further,
>>>>>>> otherwise I would try to read over the suggestions that others 
have made to
>>>>>>> you.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>
>>>>>>>> Those are mentioned on github. What are you missing from there?
>>>>>>>> There is the directory listing there, and even the apache config.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <
>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> I read over the Github issue.
>>>>>>>>>
>>>>>>>>> Can you give me your directory listing? All files, and contents,
>>>>>>>>> please. Can you also copy me on where you include the file in 
your virtual
>>>>>>>>> hosts config?
>>>>>>>>>
>>>>>>>>> Ryan
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Ryan,
>>>>>>>>>>
>>>>>>>>>> I will assume you meant "from" instead of "form", but if you
>>>>>>>>>> double check the github issue, I have been using it so.
>>>>>>>>>>
>>>>>>>>>> -- Laszlo
>>>>>>>>>>
>>>>>>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>>>>>>
>>>>>>>>>>> Do this to give yourself an idea of how namespace and imports
>>>>>>>>>>> work within Python:
>>>>>>>>>>>
>>>>>>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>>>>>>> documentation) in your file: from yourapplication import app as applic
>>>>>>>>>>> ation < /div>
>>>>>>>>>>>
>>>>>>>>>>> However, please be aware that... "yourapplication" will have to
>>>>>>>>>>> be "foo" and "app" in your case will have to be "application"
>>>>>>>>>>>
>>>>>>>>>>> In this instance, you can just do so:
>>>>>>>>>>>
>>>>>>>>>>> "form foo import application"
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Also, please be careful where you're putting these files! Seems
>>>>>>>>>>> you're not including them in the correct space.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>>>>>>>> experience with those. Apache usually has good docs from my 
understanding:
>>>>>>>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org>wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>
>>>>>>>>>>>> I would need some help to get a basic "Hello World" running on
>>>>>>>>>>>> a remote server:  https://github.com/mitsuhiko/flask/issues/825
>>>>>>>>>>>>
>>>>>>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>>>>>>> full-time job, and I am getting frustrated about it. Do you 
see any obvious
>>>>>>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>>>>>>
>>>>>>>>>>>> -- Laszlo
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-08 @ 16:14
The issue might be related that I have a default and I would not like to
disable it?

Has anyone got this working with the default on _and_ the additional
VirtualHost?


On Thu, Aug 8, 2013 at 1:56 PM, Laszlo Papp <lpapp@kde.org> wrote:

> The wsgi module seems to be loaded, too.
>
> sudo apachectl -M | grep wsgi_module
> Syntax OK
>  wsgi_module (shared)
>
>
> On Thu, Aug 8, 2013 at 12:46 PM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> Just to be explicitly clearer:
>>
>> "[Thu Aug 08 12:23:35 2013] [error] [client 192.168.3.182] File does not
>> exist: /var/www/bar" is the error message when trying to access the
>> http://A.B.C.D/bar url mapped to the hello world python function.
>>
>> Why it looking for such a physical directory when it should just be a
>> virtual url binding? I am personally not sure at this point if it is a
>> mod_wsgi or apache bug, or just a documentation/faq. Here is the 001-foo
>> sites-enabled Virtual Host config again, just in case:
>>
>> <VirtualHost *:80>
>>     ServerName foo.com
>>
>>     # WSGIDaemonProcess foo user=http group=http threads=5
>>     WSGIScriptAlias / /var/www/foo.wsgi
>>
>>     <Directory /var/www/foo>
>>         WSGIProcessGroup foo
>>         WSGIApplicationGroup %{GLOBAL}
>>         Order deny,allow
>>         Allow from all
>>     </Directory>
>> </VirtualHost>
>>
>>
>>
>> On Thu, Aug 8, 2013 at 12:12 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>
>>> OK, got cgi working... so that I can say the foo.py is a good hello
>>> world content. So, the next question would be why the wsgi does not.
>>>
>>>
>>> On Thu, Aug 8, 2013 at 11:53 AM, Laszlo Papp <lpapp@kde.org> wrote:
>>>
>>>> I just gave a try to CGI as well. Any clue?
>>>>
>>>> #!/usr/bin/python
>>>>
>>>> from wsgiref.handlers import CGIHandler
>>>>
>>>> from flask import Flask
>>>> application = Flask(__name__)
>>>>
>>>> @application.route('/baz')
>>>> def hello_world():
>>>>         return 'Hello World!'
>>>>
>>>> if __name__ == '__main__':
>>>>         application.run()
>>>>
>>>> CGIHandler().run(application)
>>>>
>>>>
>>>> 
=====================================================================================================================
>>>>
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]  * Running on
>>>> http://127.0.0.1:5000/
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Traceback
>>>> (most recent call last):
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/cgi-bin/foo.cgi", line 13, in <module>
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> application.run()
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/dist-packages/flask/app.py", line 703, in run
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> run_simple(host, port, self, **options)
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 614, in
>>>> run_simple
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     inner()
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 596, in inner
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> passthrough_errors, ssl_context).serve_forever()
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 405, in
>>>> make_server
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> passthrough_errors, ssl_context)
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 331, in
>>>> __init__
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> HTTPServer.__init__(self, (host, int(port)), handler)
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> self.server_bind()
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> SocketServer.TCPServer.server_bind(self)
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>> self.socket.bind(self.server_address)
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>> "/usr/lib/python2.7/socket.py", line 224, in meth
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     return
>>>> getattr(self._sock,name)(*args)
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] socket.error:
>>>> [Errno 98] Address already in use
>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Premature end
>>>> of script headers: foo.cgi
>>>>
>>>>
>>>> On Wed, Aug 7, 2013 at 9:47 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>
>>>>> Current problem is that the python script is not run for some reason.
>>>>>
>>>>>
>>>>> On Wed, Aug 7, 2013 at 9:43 PM, Ryan O'Donnell <
>>>>> odonnellryanc@gmail.com> wrote:
>>>>>
>>>>>> So your current problem is? The port issue?
>>>>>> On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:
>>>>>>
>>>>>>> What is incorrect? I have not seen much suggestions to be honest
>>>>>>> other than complaints about a warning, which is just as its name says
>>>>>>> warning, not critical.
>>>>>>>
>>>>>>> But even then, it is fixed by putting :80 in there as mentioned.
>>>>>>> Unfortunately, I cannot paste the slightly changed version right now as I
>>>>>>> am at home, and not at the company, but it is pretty much a ":80" for the
>>>>>>> virtual host to avoid the otherwise insignificant warnings.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <
>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>
>>>>>>>> The configuration you list in Github is absolutely incorrect, if
>>>>>>>> that's what you're using. It has already been explained to you 
why it isn't
>>>>>>>> correct.
>>>>>>>>
>>>>>>>> If you copy me on your latest, I can attempt to help further,
>>>>>>>> otherwise I would try to read over the suggestions that others 
have made to
>>>>>>>> you.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>>
>>>>>>>>> Those are mentioned on github. What are you missing from there?
>>>>>>>>> There is the directory listing there, and even the apache config.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <
>>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> I read over the Github issue.
>>>>>>>>>>
>>>>>>>>>> Can you give me your directory listing? All files, and contents,
>>>>>>>>>> please. Can you also copy me on where you include the file in 
your virtual
>>>>>>>>>> hosts config?
>>>>>>>>>>
>>>>>>>>>> Ryan
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org>wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Ryan,
>>>>>>>>>>>
>>>>>>>>>>> I will assume you meant "from" instead of "form", but if you
>>>>>>>>>>> double check the github issue, I have been using it so.
>>>>>>>>>>>
>>>>>>>>>>> -- Laszlo
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>>>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>>>>>>>
>>>>>>>>>>>> Do this to give yourself an idea of how namespace and imports
>>>>>>>>>>>> work within Python:
>>>>>>>>>>>>
>>>>>>>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>>>>>>>> documentation) in your file: from yourapplication import app 
as applic
>>>>>>>>>>>> ation < /div>
>>>>>>>>>>>>
>>>>>>>>>>>> However, please be aware that... "yourapplication" will have to
>>>>>>>>>>>> be "foo" and "app" in your case will have to be "application"
>>>>>>>>>>>>
>>>>>>>>>>>> In this instance, you can just do so:
>>>>>>>>>>>>
>>>>>>>>>>>> "form foo import application"
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Also, please be careful where you're putting these files! Seems
>>>>>>>>>>>> you're not including them in the correct space.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I can't help you with Apache Virtual Hosts, as I don't have any
>>>>>>>>>>>> experience with those. Apache usually has good docs from my 
understanding:
>>>>>>>>>>>> http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org>wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I would need some help to get a basic "Hello World" running on
>>>>>>>>>>>>> a remote server:
>>>>>>>>>>>>> https://github.com/mitsuhiko/flask/issues/825
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>>>>>>>> full-time job, and I am getting frustrated about it. Do you 
see any obvious
>>>>>>>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>>>>>>>
>>>>>>>>>>>>> -- Laszlo
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: [flask] Flask, mod_wsgi and apache issues

From:
Laszlo Papp
Date:
2013-08-08 @ 17:49
Per github, the issue is now localized, and suggestion has been made for
improvements. Thanks Ryan anyway.


On Thu, Aug 8, 2013 at 5:14 PM, Laszlo Papp <lpapp@kde.org> wrote:

> The issue might be related that I have a default and I would not like to
> disable it?
>
> Has anyone got this working with the default on _and_ the additional
> VirtualHost?
>
>
> On Thu, Aug 8, 2013 at 1:56 PM, Laszlo Papp <lpapp@kde.org> wrote:
>
>> The wsgi module seems to be loaded, too.
>>
>> sudo apachectl -M | grep wsgi_module
>> Syntax OK
>>  wsgi_module (shared)
>>
>>
>> On Thu, Aug 8, 2013 at 12:46 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>
>>> Just to be explicitly clearer:
>>>
>>> "[Thu Aug 08 12:23:35 2013] [error] [client 192.168.3.182] File does not
>>> exist: /var/www/bar" is the error message when trying to access the
>>> http://A.B.C.D/bar url mapped to the hello world python function.
>>>
>>> Why it looking for such a physical directory when it should just be a
>>> virtual url binding? I am personally not sure at this point if it is a
>>> mod_wsgi or apache bug, or just a documentation/faq. Here is the 001-foo
>>> sites-enabled Virtual Host config again, just in case:
>>>
>>> <VirtualHost *:80>
>>>     ServerName foo.com
>>>
>>>     # WSGIDaemonProcess foo user=http group=http threads=5
>>>     WSGIScriptAlias / /var/www/foo.wsgi
>>>
>>>     <Directory /var/www/foo>
>>>         WSGIProcessGroup foo
>>>         WSGIApplicationGroup %{GLOBAL}
>>>         Order deny,allow
>>>         Allow from all
>>>     </Directory>
>>> </VirtualHost>
>>>
>>>
>>>
>>> On Thu, Aug 8, 2013 at 12:12 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>
>>>> OK, got cgi working... so that I can say the foo.py is a good hello
>>>> world content. So, the next question would be why the wsgi does not.
>>>>
>>>>
>>>> On Thu, Aug 8, 2013 at 11:53 AM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>
>>>>> I just gave a try to CGI as well. Any clue?
>>>>>
>>>>> #!/usr/bin/python
>>>>>
>>>>> from wsgiref.handlers import CGIHandler
>>>>>
>>>>> from flask import Flask
>>>>> application = Flask(__name__)
>>>>>
>>>>> @application.route('/baz')
>>>>> def hello_world():
>>>>>         return 'Hello World!'
>>>>>
>>>>> if __name__ == '__main__':
>>>>>         application.run()
>>>>>
>>>>> CGIHandler().run(application)
>>>>>
>>>>>
>>>>> 
=====================================================================================================================
>>>>>
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]  * Running
>>>>> on http://127.0.0.1:5000/
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Traceback
>>>>> (most recent call last):
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/cgi-bin/foo.cgi", line 13, in <module>
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> application.run()
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/dist-packages/flask/app.py", line 703, in run
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> run_simple(host, port, self, **options)
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 614, in
>>>>> run_simple
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     inner()
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 596, in inner
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> passthrough_errors, ssl_context).serve_forever()
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 405, in
>>>>> make_server
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> passthrough_errors, ssl_context)
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 331, in
>>>>> __init__
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> HTTPServer.__init__(self, (host, int(port)), handler)
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> self.server_bind()
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> SocketServer.TCPServer.server_bind(self)
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> self.socket.bind(self.server_address)
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]   File
>>>>> "/usr/lib/python2.7/socket.py", line 224, in meth
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]     return
>>>>> getattr(self._sock,name)(*args)
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182]
>>>>> socket.error: [Errno 98] Address already in use
>>>>> [Thu Aug 08 11:39:02 2013] [error] [client 192.168.3.182] Premature
>>>>> end of script headers: foo.cgi
>>>>>
>>>>>
>>>>> On Wed, Aug 7, 2013 at 9:47 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>
>>>>>> Current problem is that the python script is not run for some reason.
>>>>>>
>>>>>>
>>>>>> On Wed, Aug 7, 2013 at 9:43 PM, Ryan O'Donnell <
>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>
>>>>>>> So your current problem is? The port issue?
>>>>>>> On Aug 7, 2013 4:38 PM, "Laszlo Papp" <lpapp@kde.org> wrote:
>>>>>>>
>>>>>>>> What is incorrect? I have not seen much suggestions to be honest
>>>>>>>> other than complaints about a warning, which is just as its name says
>>>>>>>> warning, not critical.
>>>>>>>>
>>>>>>>> But even then, it is fixed by putting :80 in there as mentioned.
>>>>>>>> Unfortunately, I cannot paste the slightly changed version right now as I
>>>>>>>> am at home, and not at the company, but it is pretty much a ":80" for the
>>>>>>>> virtual host to avoid the otherwise insignificant warnings.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Aug 7, 2013 at 9:29 PM, Ryan O'Donnell <
>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> The configuration you list in Github is absolutely incorrect, if
>>>>>>>>> that's what you're using. It has already been explained to you 
why it isn't
>>>>>>>>> correct.
>>>>>>>>>
>>>>>>>>> If you copy me on your latest, I can attempt to help further,
>>>>>>>>> otherwise I would try to read over the suggestions that others 
have made to
>>>>>>>>> you.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Aug 7, 2013 at 4:05 PM, Laszlo Papp <lpapp@kde.org> wrote:
>>>>>>>>>
>>>>>>>>>> Those are mentioned on github. What are you missing from there?
>>>>>>>>>> There is the directory listing there, and even the apache config.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Aug 7, 2013 at 8:56 PM, Ryan O'Donnell <
>>>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> I read over the Github issue.
>>>>>>>>>>>
>>>>>>>>>>> Can you give me your directory listing? All files, and contents,
>>>>>>>>>>> please. Can you also copy me on where you include the file in 
your virtual
>>>>>>>>>>> hosts config?
>>>>>>>>>>>
>>>>>>>>>>> Ryan
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Aug 7, 2013 at 3:51 PM, Laszlo Papp <lpapp@kde.org>wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Ryan,
>>>>>>>>>>>>
>>>>>>>>>>>> I will assume you meant "from" instead of "form", but if you
>>>>>>>>>>>> double check the github issue, I have been using it so.
>>>>>>>>>>>>
>>>>>>>>>>>> -- Laszlo
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Aug 7, 2013 at 8:45 PM, Ryan O'Donnell <
>>>>>>>>>>>> odonnellryanc@gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Seems to be that you're defining your application as: foo.py,
>>>>>>>>>>>>> however, you're trying to include "foo.wsgi."
>>>>>>>>>>>>>
>>>>>>>>>>>>> Do this to give yourself an idea of how namespace and imports
>>>>>>>>>>>>> work within Python:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Create a file (foo.wsgi) and put the following text (from the
>>>>>>>>>>>>> documentation) in your file: from yourapplication import app
>>>>>>>>>>>>> as applic ation < /div>
>>>>>>>>>>>>>
>>>>>>>>>>>>> However, please be aware that... "yourapplication" will have
>>>>>>>>>>>>> to be "foo" and "app" in your case will have to be "application"
>>>>>>>>>>>>>
>>>>>>>>>>>>> In this instance, you can just do so:
>>>>>>>>>>>>>
>>>>>>>>>>>>> "form foo import application"
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Also, please be careful where you're putting these files!
>>>>>>>>>>>>> Seems you're not including them in the correct space.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I can't help you with Apache Virtual Hosts, as I don't have
>>>>>>>>>>>>> any experience with those. Apache usually has good docs from my
>>>>>>>>>>>>> understanding: http://httpd.apache.org/docs/2.2/vhosts/
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Wed, Aug 7, 2013 at 3:10 PM, Laszlo Papp <lpapp@kde.org>wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I would need some help to get a basic "Hello World" running
>>>>>>>>>>>>>> on a remote server:
>>>>>>>>>>>>>> https://github.com/mitsuhiko/flask/issues/825
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have been trying to get this work for about 3-4 days in a
>>>>>>>>>>>>>> full-time job, and I am getting frustrated about it. Do you
see any obvious
>>>>>>>>>>>>>> mistake? Any useful help is appreciated. Thank you in advance.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- Laszlo
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>