librelist archives

« back to archive

Flask FastCGI deployment Apache mod_rewrite trouble

Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-17 @ 14:55
Hi,
I am trying to get my Flask application working on Hostgator shared
account using the Apache FastCGI deployment method. I am having
troubles with a getting a right configuration of Apache mod_rewrite
rules. My dispatch.fcgi file appears in URL all the times e.g.
www.example.com/dispatch.fcgi/news/.

How can I fix it? Is it because of my mod_rewrite rules or I need to
tell Flask something else?

Here is my .htacess:

RewriteEngine On
AddHandler fcgid-script .fcgi
RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]

I tried many variants none of them works for me.

-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Ron DuPlain
Date:
2012-04-17 @ 15:39
Hi Vadim,

On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
<vadim.pestovnikov@gmail.com> wrote:
> I am trying to get my Flask application working on Hostgator shared
> account using the Apache FastCGI deployment method. I am having
> troubles with a getting a right configuration of Apache mod_rewrite
> rules. My dispatch.fcgi file appears in URL all the times e.g.
> www.example.com/dispatch.fcgi/news/.
>
> How can I fix it? Is it because of my mod_rewrite rules or I need to
> tell Flask something else?
>
> Here is my .htacess:
>
> RewriteEngine On
> AddHandler fcgid-script .fcgi
> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>
> I tried many variants none of them works for me.

Have you seen the doc here?
http://flask.pocoo.org/docs/deploying/fastcgi/

If it doesn't clarify the issue, could you post an issue to Flask when
you have your deployment working?

-Ron

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-18 @ 00:46
Hi Ron,
I have found a fix to my issue. You were saying "could you post an
issue to Flask"
where is that place. This mailing list or some where else?

Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
It just doesn't work well with Flask.


On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Hi Vadim,
>
> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> I am trying to get my Flask application working on Hostgator shared
>> account using the Apache FastCGI deployment method. I am having
>> troubles with a getting a right configuration of Apache mod_rewrite
>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>> www.example.com/dispatch.fcgi/news/.
>>
>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>> tell Flask something else?
>>
>> Here is my .htacess:
>>
>> RewriteEngine On
>> AddHandler fcgid-script .fcgi
>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>
>> I tried many variants none of them works for me.
>
> Have you seen the doc here?
> http://flask.pocoo.org/docs/deploying/fastcgi/
>
> If it doesn't clarify the issue, could you post an issue to Flask when
> you have your deployment working?
>
> -Ron



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Ron DuPlain
Date:
2012-04-18 @ 00:51
Issue tracker is here:
https://github.com/mitsuhiko/flask/issues

Thanks,

Ron


On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
<vadim.pestovnikov@gmail.com> wrote:
> Hi Ron,
> I have found a fix to my issue. You were saying "could you post an
> issue to Flask"
> where is that place. This mailing list or some where else?
>
> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
> It just doesn't work well with Flask.
>
>
> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>> Hi Vadim,
>>
>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>> <vadim.pestovnikov@gmail.com> wrote:
>>> I am trying to get my Flask application working on Hostgator shared
>>> account using the Apache FastCGI deployment method. I am having
>>> troubles with a getting a right configuration of Apache mod_rewrite
>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>> www.example.com/dispatch.fcgi/news/.
>>>
>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>> tell Flask something else?
>>>
>>> Here is my .htacess:
>>>
>>> RewriteEngine On
>>> AddHandler fcgid-script .fcgi
>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>
>>> I tried many variants none of them works for me.
>>
>> Have you seen the doc here?
>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>
>> If it doesn't clarify the issue, could you post an issue to Flask when
>> you have your deployment working?
>>
>> -Ron
>
>
>
> --
> Best Regards,
> Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-18 @ 01:00
Well, as I said it is not the Flask issue. I don't think Armin will be
happy :) I will replay tomorrow to this mailing list and you guys will
decide where to put it. I need some time to monitor my website and
make sure that is the stable solution.

On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Issue tracker is here:
> https://github.com/mitsuhiko/flask/issues
>
> Thanks,
>
> Ron
>
>
> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> Hi Ron,
>> I have found a fix to my issue. You were saying "could you post an
>> issue to Flask"
>> where is that place. This mailing list or some where else?
>>
>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>> It just doesn't work well with Flask.
>>
>>
>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>> Hi Vadim,
>>>
>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>> <vadim.pestovnikov@gmail.com> wrote:
>>>> I am trying to get my Flask application working on Hostgator shared
>>>> account using the Apache FastCGI deployment method. I am having
>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>> www.example.com/dispatch.fcgi/news/.
>>>>
>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>> tell Flask something else?
>>>>
>>>> Here is my .htacess:
>>>>
>>>> RewriteEngine On
>>>> AddHandler fcgid-script .fcgi
>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>
>>>> I tried many variants none of them works for me.
>>>
>>> Have you seen the doc here?
>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>
>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>> you have your deployment working?
>>>
>>> -Ron
>>
>>
>>
>> --
>> Best Regards,
>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-19 @ 07:56
Hi all,
Recently I had a problem with deploying my Flask application on my
shared Hostgator account with Apache and <mod_fastcgid> module which
is only one option so far. The problem was Apache <mod_rewrite> module
produced a wrong setting for Flask application, my dispatch.fsgi file
appeared all the times as a part of URL no matter which RewriteRule I
tried. Finally I found some ideas in this mailing list, people had
similar problems.

***

Here is my .htaccess:

<IfModule mod_fcgid.c>
    AddHandler fcgid-script .fcgi
    <Files ~ (\.fcgi)>
        SetHandler fcgid-script
        Options +FollowSymLinks +ExecCGI
    </Files>
</IfModule>

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
</IfModule>

***

Here is my dispatch.fsgi:

#!/usr/bin/python

import sys
sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')

from flup.server.fcgi import WSGIServer
from yourapplication import app

class ScriptNameStripper(object):
    to_strip = '/dispatch.fcgi'
    def __init__(self, app):
        self.app = app
    def __call__(self, environ, start_response):
	environ['SCRIPT_NAME'] = ''
        return self.app(environ, start_response)

app = ScriptNameStripper(app)

if __name__ == '__main__':
    WSGIServer(app).run()

***

That is all.

Similar problems:


http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa


http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3



On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
<vadim.pestovnikov@gmail.com> wrote:
> Well, as I said it is not the Flask issue. I don't think Armin will be
> happy :) I will replay tomorrow to this mailing list and you guys will
> decide where to put it. I need some time to monitor my website and
> make sure that is the stable solution.
>
> On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>> Issue tracker is here:
>> https://github.com/mitsuhiko/flask/issues
>>
>> Thanks,
>>
>> Ron
>>
>>
>> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
>> <vadim.pestovnikov@gmail.com> wrote:
>>> Hi Ron,
>>> I have found a fix to my issue. You were saying "could you post an
>>> issue to Flask"
>>> where is that place. This mailing list or some where else?
>>>
>>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>>> It just doesn't work well with Flask.
>>>
>>>
>>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>> Hi Vadim,
>>>>
>>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>> I am trying to get my Flask application working on Hostgator shared
>>>>> account using the Apache FastCGI deployment method. I am having
>>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>>> www.example.com/dispatch.fcgi/news/.
>>>>>
>>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>>> tell Flask something else?
>>>>>
>>>>> Here is my .htacess:
>>>>>
>>>>> RewriteEngine On
>>>>> AddHandler fcgid-script .fcgi
>>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>>
>>>>> I tried many variants none of them works for me.
>>>>
>>>> Have you seen the doc here?
>>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>>
>>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>>> you have your deployment working?
>>>>
>>>> -Ron
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>
>
>
> --
> Best Regards,
> Vadim Pestovnikov | vadim.pestovnikov@gmail.com



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Peter Schmidler
Date:
2012-04-19 @ 21:07

-- 
Peter Schmidler
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Thursday, 19. April 2012 at 09:56, Vadim Pestovnikov wrote:

> Hi all,
> Recently I had a problem with deploying my Flask application on my
> shared Hostgator account with Apache and <mod_fastcgid> module which
> is only one option so far. The problem was Apache <mod_rewrite> module
> produced a wrong setting for Flask application, my dispatch.fsgi file
> appeared all the times as a part of URL no matter which RewriteRule I
> tried. Finally I found some ideas in this mailing list, people had
> similar problems.
> 
> ***
> 
> Here is my .htaccess:
> 
> <IfModule mod_fcgid.c>
> AddHandler fcgid-script .fcgi
> <Files ~ (\.fcgi)>
> SetHandler fcgid-script
> Options +FollowSymLinks +ExecCGI
> </Files>
> </IfModule>
> 
> <IfModule mod_rewrite.c>
> Options +FollowSymlinks
> RewriteEngine On
> RewriteBase /
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
> </IfModule>
> 
> ***
> 
> Here is my dispatch.fsgi:
> 
> #!/usr/bin/python
> 
> import sys
> sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')
> 
> from flup.server.fcgi import WSGIServer
> from yourapplication import app
> 
> class ScriptNameStripper(object):
> to_strip = '/dispatch.fcgi'
> def __init__(self, app):
> self.app = app
> def __call__(self, environ, start_response):
> environ['SCRIPT_NAME'] = ''
> return self.app(environ, start_response)
> 
> app = ScriptNameStripper(app)
> 
> if __name__ == '__main__':
> WSGIServer(app).run()
> 
> ***
> 
> That is all.
> 
> Similar problems:
> 
> 
http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa
> 
> 
http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3
> 
> 
> 
> On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
> > Well, as I said it is not the Flask issue. I don't think Armin will be
> > happy :) I will replay tomorrow to this mailing list and you guys will
> > decide where to put it. I need some time to monitor my website and
> > make sure that is the stable solution.
> > 
> > On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> > > Issue tracker is here:
> > > https://github.com/mitsuhiko/flask/issues
> > > 
> > > Thanks,
> > > 
> > > Ron
> > > 
> > > 
> > > On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
> > > <vadim.pestovnikov@gmail.com> wrote:
> > > > Hi Ron,
> > > > I have found a fix to my issue. You were saying "could you post an
> > > > issue to Flask"
> > > > where is that place. This mailing list or some where else?
> > > > 
> > > > Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
> > > > It just doesn't work well with Flask.
> > > > 
> > > > 
> > > > On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain 
<ron.duplain@gmail.com> wrote:
> > > > > Hi Vadim,
> > > > > 
> > > > > On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
> > > > > <vadim.pestovnikov@gmail.com> wrote:
> > > > > > I am trying to get my Flask application working on Hostgator shared
> > > > > > account using the Apache FastCGI deployment method. I am having
> > > > > > troubles with a getting a right configuration of Apache mod_rewrite
> > > > > > rules. My dispatch.fcgi file appears in URL all the times e.g.
> > > > > > www.example.com/dispatch.fcgi/news/.
> > > > > > 
> > > > > > How can I fix it? Is it because of my mod_rewrite rules or I need to
> > > > > > tell Flask something else?
> > > > > > 
> > > > > > Here is my .htacess:
> > > > > > 
> > > > > > RewriteEngine On
> > > > > > AddHandler fcgid-script .fcgi
> > > > > > RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
> > > > > > RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
> > > > > > 
> > > > > > I tried many variants none of them works for me.
> > > > > 
> > > > > Have you seen the doc here?
> > > > > http://flask.pocoo.org/docs/deploying/fastcgi/
> > > > > 
> > > > > If it doesn't clarify the issue, could you post an issue to Flask when
> > > > > you have your deployment working?
> > > > > 
> > > > > -Ron
> > > > 
> > > > 
> > > > 
> > > > --
> > > > Best Regards,
> > > > Vadim Pestovnikov | vadim.pestovnikov@gmail.com
> > > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> > --
> > Best Regards,
> > Vadim Pestovnikov | vadim.pestovnikov@gmail.com
> > 
> 
> 
> 
> 
> -- 
> Best Regards,
> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
> 
> 

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Ron DuPlain
Date:
2012-04-19 @ 14:22
Hi Vadim,

Are you up for submitting a pull request on the Flask fastcgi docs?
If not, let's file an issue to use your message here in improving the
doc.
Thanks,

Ron


On Thu, Apr 19, 2012 at 3:56 AM, Vadim Pestovnikov
<vadim.pestovnikov@gmail.com> wrote:
> Hi all,
> Recently I had a problem with deploying my Flask application on my
> shared Hostgator account with Apache and <mod_fastcgid> module which
> is only one option so far. The problem was Apache <mod_rewrite> module
> produced a wrong setting for Flask application, my dispatch.fsgi file
> appeared all the times as a part of URL no matter which RewriteRule I
> tried. Finally I found some ideas in this mailing list, people had
> similar problems.
>
> ***
>
> Here is my .htaccess:
>
> <IfModule mod_fcgid.c>
>    AddHandler fcgid-script .fcgi
>    <Files ~ (\.fcgi)>
>        SetHandler fcgid-script
>        Options +FollowSymLinks +ExecCGI
>    </Files>
> </IfModule>
>
> <IfModule mod_rewrite.c>
>    Options +FollowSymlinks
>    RewriteEngine On
>    RewriteBase /
>    RewriteCond %{REQUEST_FILENAME} !-f
>    RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
> </IfModule>
>
> ***
>
> Here is my dispatch.fsgi:
>
> #!/usr/bin/python
>
> import sys
> sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')
>
> from flup.server.fcgi import WSGIServer
> from yourapplication import app
>
> class ScriptNameStripper(object):
>    to_strip = '/dispatch.fcgi'
>    def __init__(self, app):
>        self.app = app
>    def __call__(self, environ, start_response):
>        environ['SCRIPT_NAME'] = ''
>        return self.app(environ, start_response)
>
> app = ScriptNameStripper(app)
>
> if __name__ == '__main__':
>    WSGIServer(app).run()
>
> ***
>
> That is all.
>
> Similar problems:
>
> 
http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa
>
> 
http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3
>
>
>
> On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> Well, as I said it is not the Flask issue. I don't think Armin will be
>> happy :) I will replay tomorrow to this mailing list and you guys will
>> decide where to put it. I need some time to monitor my website and
>> make sure that is the stable solution.
>>
>> On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>> Issue tracker is here:
>>> https://github.com/mitsuhiko/flask/issues
>>>
>>> Thanks,
>>>
>>> Ron
>>>
>>>
>>> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
>>> <vadim.pestovnikov@gmail.com> wrote:
>>>> Hi Ron,
>>>> I have found a fix to my issue. You were saying "could you post an
>>>> issue to Flask"
>>>> where is that place. This mailing list or some where else?
>>>>
>>>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>>>> It just doesn't work well with Flask.
>>>>
>>>>
>>>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>>> Hi Vadim,
>>>>>
>>>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>> I am trying to get my Flask application working on Hostgator shared
>>>>>> account using the Apache FastCGI deployment method. I am having
>>>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>>>> www.example.com/dispatch.fcgi/news/.
>>>>>>
>>>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>>>> tell Flask something else?
>>>>>>
>>>>>> Here is my .htacess:
>>>>>>
>>>>>> RewriteEngine On
>>>>>> AddHandler fcgid-script .fcgi
>>>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>>>
>>>>>> I tried many variants none of them works for me.
>>>>>
>>>>> Have you seen the doc here?
>>>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>>>
>>>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>>>> you have your deployment working?
>>>>>
>>>>> -Ron
>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>
>>
>>
>> --
>> Best Regards,
>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>
>
>
> --
> Best Regards,
> Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-19 @ 14:41
Hi Ron,
I would be delighted to do that.

The problem is I just started working with Flask and I am not very
familiar with Flask community procedures. On the other hands I checked
this place https://github.com/mitsuhiko/flask/pulls and got lost a
bit. I never used github before. Do I need an account there in order
to submit a pull request on the Flask fastcgi docs? Also where is that
place to file the issue in improving the doc?



On Thu, Apr 19, 2012 at 10:22 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Hi Vadim,
>
> Are you up for submitting a pull request on the Flask fastcgi docs?
> If not, let's file an issue to use your message here in improving the
> doc.
> Thanks,
>
> Ron
>
>
> On Thu, Apr 19, 2012 at 3:56 AM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> Hi all,
>> Recently I had a problem with deploying my Flask application on my
>> shared Hostgator account with Apache and <mod_fastcgid> module which
>> is only one option so far. The problem was Apache <mod_rewrite> module
>> produced a wrong setting for Flask application, my dispatch.fsgi file
>> appeared all the times as a part of URL no matter which RewriteRule I
>> tried. Finally I found some ideas in this mailing list, people had
>> similar problems.
>>
>> ***
>>
>> Here is my .htaccess:
>>
>> <IfModule mod_fcgid.c>
>>    AddHandler fcgid-script .fcgi
>>    <Files ~ (\.fcgi)>
>>        SetHandler fcgid-script
>>        Options +FollowSymLinks +ExecCGI
>>    </Files>
>> </IfModule>
>>
>> <IfModule mod_rewrite.c>
>>    Options +FollowSymlinks
>>    RewriteEngine On
>>    RewriteBase /
>>    RewriteCond %{REQUEST_FILENAME} !-f
>>    RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
>> </IfModule>
>>
>> ***
>>
>> Here is my dispatch.fsgi:
>>
>> #!/usr/bin/python
>>
>> import sys
>> sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')
>>
>> from flup.server.fcgi import WSGIServer
>> from yourapplication import app
>>
>> class ScriptNameStripper(object):
>>    to_strip = '/dispatch.fcgi'
>>    def __init__(self, app):
>>        self.app = app
>>    def __call__(self, environ, start_response):
>>        environ['SCRIPT_NAME'] = ''
>>        return self.app(environ, start_response)
>>
>> app = ScriptNameStripper(app)
>>
>> if __name__ == '__main__':
>>    WSGIServer(app).run()
>>
>> ***
>>
>> That is all.
>>
>> Similar problems:
>>
>> 
http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa
>>
>> 
http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3
>>
>>
>>
>> On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
>> <vadim.pestovnikov@gmail.com> wrote:
>>> Well, as I said it is not the Flask issue. I don't think Armin will be
>>> happy :) I will replay tomorrow to this mailing list and you guys will
>>> decide where to put it. I need some time to monitor my website and
>>> make sure that is the stable solution.
>>>
>>> On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>> Issue tracker is here:
>>>> https://github.com/mitsuhiko/flask/issues
>>>>
>>>> Thanks,
>>>>
>>>> Ron
>>>>
>>>>
>>>> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>> Hi Ron,
>>>>> I have found a fix to my issue. You were saying "could you post an
>>>>> issue to Flask"
>>>>> where is that place. This mailing list or some where else?
>>>>>
>>>>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>>>>> It just doesn't work well with Flask.
>>>>>
>>>>>
>>>>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>>>> Hi Vadim,
>>>>>>
>>>>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>> I am trying to get my Flask application working on Hostgator shared
>>>>>>> account using the Apache FastCGI deployment method. I am having
>>>>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>>>>> www.example.com/dispatch.fcgi/news/.
>>>>>>>
>>>>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>>>>> tell Flask something else?
>>>>>>>
>>>>>>> Here is my .htacess:
>>>>>>>
>>>>>>> RewriteEngine On
>>>>>>> AddHandler fcgid-script .fcgi
>>>>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>>>>
>>>>>>> I tried many variants none of them works for me.
>>>>>>
>>>>>> Have you seen the doc here?
>>>>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>>>>
>>>>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>>>>> you have your deployment working?
>>>>>>
>>>>>> -Ron
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>
>>
>>
>> --
>> Best Regards,
>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Ron DuPlain
Date:
2012-04-19 @ 14:52
Hi Vadim,

The help docs at GitHub are excellent:
http://help.github.com/be-social/

If you prefer, you can send me an updated .rst, or a .patch file
(using old-school diff).  The community process is to get a patch in
front of a committer.  :-)  The best way to do this is through GitHub
pull requests, as they are open for comments and publicly posted.
Other times, you can discuss it on IRC.  I don't want git+github to
get in the way of a good patch.  I encourage everyone to learn git
because it's very useful, but I'll take any well-intended patch and
review it, no matter the delivery.  That said, I'm sure someone will
hand-write a patch and mail to me through the postal service.

IRC details are here:
http://flask.pocoo.org/community/irc/

Failing that, someone else could patch the doc based on your message.
But I prefer to make a direct contributor out of you!

Ron


On Thu, Apr 19, 2012 at 10:41 AM, Vadim Pestovnikov
<vadim.pestovnikov@gmail.com> wrote:
> Hi Ron,
> I would be delighted to do that.
>
> The problem is I just started working with Flask and I am not very
> familiar with Flask community procedures. On the other hands I checked
> this place https://github.com/mitsuhiko/flask/pulls and got lost a
> bit. I never used github before. Do I need an account there in order
> to submit a pull request on the Flask fastcgi docs? Also where is that
> place to file the issue in improving the doc?
>
>
>
> On Thu, Apr 19, 2012 at 10:22 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>> Hi Vadim,
>>
>> Are you up for submitting a pull request on the Flask fastcgi docs?
>> If not, let's file an issue to use your message here in improving the
>> doc.
>> Thanks,
>>
>> Ron
>>
>>
>> On Thu, Apr 19, 2012 at 3:56 AM, Vadim Pestovnikov
>> <vadim.pestovnikov@gmail.com> wrote:
>>> Hi all,
>>> Recently I had a problem with deploying my Flask application on my
>>> shared Hostgator account with Apache and <mod_fastcgid> module which
>>> is only one option so far. The problem was Apache <mod_rewrite> module
>>> produced a wrong setting for Flask application, my dispatch.fsgi file
>>> appeared all the times as a part of URL no matter which RewriteRule I
>>> tried. Finally I found some ideas in this mailing list, people had
>>> similar problems.
>>>
>>> ***
>>>
>>> Here is my .htaccess:
>>>
>>> <IfModule mod_fcgid.c>
>>>    AddHandler fcgid-script .fcgi
>>>    <Files ~ (\.fcgi)>
>>>        SetHandler fcgid-script
>>>        Options +FollowSymLinks +ExecCGI
>>>    </Files>
>>> </IfModule>
>>>
>>> <IfModule mod_rewrite.c>
>>>    Options +FollowSymlinks
>>>    RewriteEngine On
>>>    RewriteBase /
>>>    RewriteCond %{REQUEST_FILENAME} !-f
>>>    RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
>>> </IfModule>
>>>
>>> ***
>>>
>>> Here is my dispatch.fsgi:
>>>
>>> #!/usr/bin/python
>>>
>>> import sys
>>> sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')
>>>
>>> from flup.server.fcgi import WSGIServer
>>> from yourapplication import app
>>>
>>> class ScriptNameStripper(object):
>>>    to_strip = '/dispatch.fcgi'
>>>    def __init__(self, app):
>>>        self.app = app
>>>    def __call__(self, environ, start_response):
>>>        environ['SCRIPT_NAME'] = ''
>>>        return self.app(environ, start_response)
>>>
>>> app = ScriptNameStripper(app)
>>>
>>> if __name__ == '__main__':
>>>    WSGIServer(app).run()
>>>
>>> ***
>>>
>>> That is all.
>>>
>>> Similar problems:
>>>
>>> 
http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa
>>>
>>> 
http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3
>>>
>>>
>>>
>>> On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
>>> <vadim.pestovnikov@gmail.com> wrote:
>>>> Well, as I said it is not the Flask issue. I don't think Armin will be
>>>> happy :) I will replay tomorrow to this mailing list and you guys will
>>>> decide where to put it. I need some time to monitor my website and
>>>> make sure that is the stable solution.
>>>>
>>>> On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>>> Issue tracker is here:
>>>>> https://github.com/mitsuhiko/flask/issues
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Ron
>>>>>
>>>>>
>>>>> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>> Hi Ron,
>>>>>> I have found a fix to my issue. You were saying "could you post an
>>>>>> issue to Flask"
>>>>>> where is that place. This mailing list or some where else?
>>>>>>
>>>>>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>>>>>> It just doesn't work well with Flask.
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain 
<ron.duplain@gmail.com> wrote:
>>>>>>> Hi Vadim,
>>>>>>>
>>>>>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>>> I am trying to get my Flask application working on Hostgator shared
>>>>>>>> account using the Apache FastCGI deployment method. I am having
>>>>>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>>>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>>>>>> www.example.com/dispatch.fcgi/news/.
>>>>>>>>
>>>>>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>>>>>> tell Flask something else?
>>>>>>>>
>>>>>>>> Here is my .htacess:
>>>>>>>>
>>>>>>>> RewriteEngine On
>>>>>>>> AddHandler fcgid-script .fcgi
>>>>>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>>>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>>>>>
>>>>>>>> I tried many variants none of them works for me.
>>>>>>>
>>>>>>> Have you seen the doc here?
>>>>>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>>>>>
>>>>>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>>>>>> you have your deployment working?
>>>>>>>
>>>>>>> -Ron
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best Regards,
>>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>
>
>
> --
> Best Regards,
> Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-20 @ 05:24
Hi Ron,
Please find attached fastcgi.rst file for your review.

On Thu, Apr 19, 2012 at 10:52 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Hi Vadim,
>
> The help docs at GitHub are excellent:
> http://help.github.com/be-social/
>
> If you prefer, you can send me an updated .rst, or a .patch file
> (using old-school diff).  The community process is to get a patch in
> front of a committer.  :-)  The best way to do this is through GitHub
> pull requests, as they are open for comments and publicly posted.
> Other times, you can discuss it on IRC.  I don't want git+github to
> get in the way of a good patch.  I encourage everyone to learn git
> because it's very useful, but I'll take any well-intended patch and
> review it, no matter the delivery.  That said, I'm sure someone will
> hand-write a patch and mail to me through the postal service.
>
> IRC details are here:
> http://flask.pocoo.org/community/irc/
>
> Failing that, someone else could patch the doc based on your message.
> But I prefer to make a direct contributor out of you!
>
> Ron
>
>
> On Thu, Apr 19, 2012 at 10:41 AM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> Hi Ron,
>> I would be delighted to do that.
>>
>> The problem is I just started working with Flask and I am not very
>> familiar with Flask community procedures. On the other hands I checked
>> this place https://github.com/mitsuhiko/flask/pulls and got lost a
>> bit. I never used github before. Do I need an account there in order
>> to submit a pull request on the Flask fastcgi docs? Also where is that
>> place to file the issue in improving the doc?
>>
>>
>>
>> On Thu, Apr 19, 2012 at 10:22 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>> Hi Vadim,
>>>
>>> Are you up for submitting a pull request on the Flask fastcgi docs?
>>> If not, let's file an issue to use your message here in improving the
>>> doc.
>>> Thanks,
>>>
>>> Ron
>>>
>>>
>>> On Thu, Apr 19, 2012 at 3:56 AM, Vadim Pestovnikov
>>> <vadim.pestovnikov@gmail.com> wrote:
>>>> Hi all,
>>>> Recently I had a problem with deploying my Flask application on my
>>>> shared Hostgator account with Apache and <mod_fastcgid> module which
>>>> is only one option so far. The problem was Apache <mod_rewrite> module
>>>> produced a wrong setting for Flask application, my dispatch.fsgi file
>>>> appeared all the times as a part of URL no matter which RewriteRule I
>>>> tried. Finally I found some ideas in this mailing list, people had
>>>> similar problems.
>>>>
>>>> ***
>>>>
>>>> Here is my .htaccess:
>>>>
>>>> <IfModule mod_fcgid.c>
>>>>    AddHandler fcgid-script .fcgi
>>>>    <Files ~ (\.fcgi)>
>>>>        SetHandler fcgid-script
>>>>        Options +FollowSymLinks +ExecCGI
>>>>    </Files>
>>>> </IfModule>
>>>>
>>>> <IfModule mod_rewrite.c>
>>>>    Options +FollowSymlinks
>>>>    RewriteEngine On
>>>>    RewriteBase /
>>>>    RewriteCond %{REQUEST_FILENAME} !-f
>>>>    RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
>>>> </IfModule>
>>>>
>>>> ***
>>>>
>>>> Here is my dispatch.fsgi:
>>>>
>>>> #!/usr/bin/python
>>>>
>>>> import sys
>>>> sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')
>>>>
>>>> from flup.server.fcgi import WSGIServer
>>>> from yourapplication import app
>>>>
>>>> class ScriptNameStripper(object):
>>>>    to_strip = '/dispatch.fcgi'
>>>>    def __init__(self, app):
>>>>        self.app = app
>>>>    def __call__(self, environ, start_response):
>>>>        environ['SCRIPT_NAME'] = ''
>>>>        return self.app(environ, start_response)
>>>>
>>>> app = ScriptNameStripper(app)
>>>>
>>>> if __name__ == '__main__':
>>>>    WSGIServer(app).run()
>>>>
>>>> ***
>>>>
>>>> That is all.
>>>>
>>>> Similar problems:
>>>>
>>>> 
http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa
>>>>
>>>> 
http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3
>>>>
>>>>
>>>>
>>>> On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>> Well, as I said it is not the Flask issue. I don't think Armin will be
>>>>> happy :) I will replay tomorrow to this mailing list and you guys will
>>>>> decide where to put it. I need some time to monitor my website and
>>>>> make sure that is the stable solution.
>>>>>
>>>>> On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>>>> Issue tracker is here:
>>>>>> https://github.com/mitsuhiko/flask/issues
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Ron
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>> Hi Ron,
>>>>>>> I have found a fix to my issue. You were saying "could you post an
>>>>>>> issue to Flask"
>>>>>>> where is that place. This mailing list or some where else?
>>>>>>>
>>>>>>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>>>>>>> It just doesn't work well with Flask.
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain 
<ron.duplain@gmail.com> wrote:
>>>>>>>> Hi Vadim,
>>>>>>>>
>>>>>>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>>>> I am trying to get my Flask application working on Hostgator shared
>>>>>>>>> account using the Apache FastCGI deployment method. I am having
>>>>>>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>>>>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>>>>>>> www.example.com/dispatch.fcgi/news/.
>>>>>>>>>
>>>>>>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>>>>>>> tell Flask something else?
>>>>>>>>>
>>>>>>>>> Here is my .htacess:
>>>>>>>>>
>>>>>>>>> RewriteEngine On
>>>>>>>>> AddHandler fcgid-script .fcgi
>>>>>>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>>>>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>>>>>>
>>>>>>>>> I tried many variants none of them works for me.
>>>>>>>>
>>>>>>>> Have you seen the doc here?
>>>>>>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>>>>>>
>>>>>>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>>>>>>> you have your deployment working?
>>>>>>>>
>>>>>>>> -Ron
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Best Regards,
>>>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>
>>
>>
>> --
>> Best Regards,
>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Ron DuPlain
Date:
2012-04-20 @ 13:22
Thanks Vadim. Your changes are live. Commits are here:

https://github.com/mitsuhiko/flask/compare/a3cb2a3382...fb01187885

Doc is updated here:

http://flask.pocoo.org/docs/deploying/fastcgi/

-Ron


On Fri, Apr 20, 2012 at 1:24 AM, Vadim Pestovnikov
<vadim.pestovnikov@gmail.com> wrote:
> Hi Ron,
> Please find attached fastcgi.rst file for your review.
>
> On Thu, Apr 19, 2012 at 10:52 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>> Hi Vadim,
>>
>> The help docs at GitHub are excellent:
>> http://help.github.com/be-social/
>>
>> If you prefer, you can send me an updated .rst, or a .patch file
>> (using old-school diff).  The community process is to get a patch in
>> front of a committer.  :-)  The best way to do this is through GitHub
>> pull requests, as they are open for comments and publicly posted.
>> Other times, you can discuss it on IRC.  I don't want git+github to
>> get in the way of a good patch.  I encourage everyone to learn git
>> because it's very useful, but I'll take any well-intended patch and
>> review it, no matter the delivery.  That said, I'm sure someone will
>> hand-write a patch and mail to me through the postal service.
>>
>> IRC details are here:
>> http://flask.pocoo.org/community/irc/
>>
>> Failing that, someone else could patch the doc based on your message.
>> But I prefer to make a direct contributor out of you!
>>
>> Ron
>>
>>
>> On Thu, Apr 19, 2012 at 10:41 AM, Vadim Pestovnikov
>> <vadim.pestovnikov@gmail.com> wrote:
>>> Hi Ron,
>>> I would be delighted to do that.
>>>
>>> The problem is I just started working with Flask and I am not very
>>> familiar with Flask community procedures. On the other hands I checked
>>> this place https://github.com/mitsuhiko/flask/pulls and got lost a
>>> bit. I never used github before. Do I need an account there in order
>>> to submit a pull request on the Flask fastcgi docs? Also where is that
>>> place to file the issue in improving the doc?
>>>
>>>
>>>
>>> On Thu, Apr 19, 2012 at 10:22 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>> Hi Vadim,
>>>>
>>>> Are you up for submitting a pull request on the Flask fastcgi docs?
>>>> If not, let's file an issue to use your message here in improving the
>>>> doc.
>>>> Thanks,
>>>>
>>>> Ron
>>>>
>>>>
>>>> On Thu, Apr 19, 2012 at 3:56 AM, Vadim Pestovnikov
>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>> Hi all,
>>>>> Recently I had a problem with deploying my Flask application on my
>>>>> shared Hostgator account with Apache and <mod_fastcgid> module which
>>>>> is only one option so far. The problem was Apache <mod_rewrite> module
>>>>> produced a wrong setting for Flask application, my dispatch.fsgi file
>>>>> appeared all the times as a part of URL no matter which RewriteRule I
>>>>> tried. Finally I found some ideas in this mailing list, people had
>>>>> similar problems.
>>>>>
>>>>> ***
>>>>>
>>>>> Here is my .htaccess:
>>>>>
>>>>> <IfModule mod_fcgid.c>
>>>>>    AddHandler fcgid-script .fcgi
>>>>>    <Files ~ (\.fcgi)>
>>>>>        SetHandler fcgid-script
>>>>>        Options +FollowSymLinks +ExecCGI
>>>>>    </Files>
>>>>> </IfModule>
>>>>>
>>>>> <IfModule mod_rewrite.c>
>>>>>    Options +FollowSymlinks
>>>>>    RewriteEngine On
>>>>>    RewriteBase /
>>>>>    RewriteCond %{REQUEST_FILENAME} !-f
>>>>>    RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
>>>>> </IfModule>
>>>>>
>>>>> ***
>>>>>
>>>>> Here is my dispatch.fsgi:
>>>>>
>>>>> #!/usr/bin/python
>>>>>
>>>>> import sys
>>>>> sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')
>>>>>
>>>>> from flup.server.fcgi import WSGIServer
>>>>> from yourapplication import app
>>>>>
>>>>> class ScriptNameStripper(object):
>>>>>    to_strip = '/dispatch.fcgi'
>>>>>    def __init__(self, app):
>>>>>        self.app = app
>>>>>    def __call__(self, environ, start_response):
>>>>>        environ['SCRIPT_NAME'] = ''
>>>>>        return self.app(environ, start_response)
>>>>>
>>>>> app = ScriptNameStripper(app)
>>>>>
>>>>> if __name__ == '__main__':
>>>>>    WSGIServer(app).run()
>>>>>
>>>>> ***
>>>>>
>>>>> That is all.
>>>>>
>>>>> Similar problems:
>>>>>
>>>>> 
http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa
>>>>>
>>>>> 
http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>> Well, as I said it is not the Flask issue. I don't think Armin will be
>>>>>> happy :) I will replay tomorrow to this mailing list and you guys will
>>>>>> decide where to put it. I need some time to monitor my website and
>>>>>> make sure that is the stable solution.
>>>>>>
>>>>>> On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>>>>> Issue tracker is here:
>>>>>>> https://github.com/mitsuhiko/flask/issues
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Ron
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
>>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>>> Hi Ron,
>>>>>>>> I have found a fix to my issue. You were saying "could you post an
>>>>>>>> issue to Flask"
>>>>>>>> where is that place. This mailing list or some where else?
>>>>>>>>
>>>>>>>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>>>>>>>> It just doesn't work well with Flask.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain 
<ron.duplain@gmail.com> wrote:
>>>>>>>>> Hi Vadim,
>>>>>>>>>
>>>>>>>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>>>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>>>>> I am trying to get my Flask application working on Hostgator shared
>>>>>>>>>> account using the Apache FastCGI deployment method. I am having
>>>>>>>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>>>>>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>>>>>>>> www.example.com/dispatch.fcgi/news/.
>>>>>>>>>>
>>>>>>>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>>>>>>>> tell Flask something else?
>>>>>>>>>>
>>>>>>>>>> Here is my .htacess:
>>>>>>>>>>
>>>>>>>>>> RewriteEngine On
>>>>>>>>>> AddHandler fcgid-script .fcgi
>>>>>>>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>>>>>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>>>>>>>
>>>>>>>>>> I tried many variants none of them works for me.
>>>>>>>>>
>>>>>>>>> Have you seen the doc here?
>>>>>>>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>>>>>>>
>>>>>>>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>>>>>>>> you have your deployment working?
>>>>>>>>>
>>>>>>>>> -Ron
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Best Regards,
>>>>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best Regards,
>>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>
>
>
> --
> Best Regards,
> Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-19 @ 16:42
Thanks Ron for clearing this up.
I will try to come up with .rst file asap, never used it before either
but it was seating in  my todo list until now.

On Thu, Apr 19, 2012 at 10:52 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Hi Vadim,
>
> The help docs at GitHub are excellent:
> http://help.github.com/be-social/
>
> If you prefer, you can send me an updated .rst, or a .patch file
> (using old-school diff).  The community process is to get a patch in
> front of a committer.  :-)  The best way to do this is through GitHub
> pull requests, as they are open for comments and publicly posted.
> Other times, you can discuss it on IRC.  I don't want git+github to
> get in the way of a good patch.  I encourage everyone to learn git
> because it's very useful, but I'll take any well-intended patch and
> review it, no matter the delivery.  That said, I'm sure someone will
> hand-write a patch and mail to me through the postal service.
>
> IRC details are here:
> http://flask.pocoo.org/community/irc/
>
> Failing that, someone else could patch the doc based on your message.
> But I prefer to make a direct contributor out of you!
>
> Ron
>
>
> On Thu, Apr 19, 2012 at 10:41 AM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> Hi Ron,
>> I would be delighted to do that.
>>
>> The problem is I just started working with Flask and I am not very
>> familiar with Flask community procedures. On the other hands I checked
>> this place https://github.com/mitsuhiko/flask/pulls and got lost a
>> bit. I never used github before. Do I need an account there in order
>> to submit a pull request on the Flask fastcgi docs? Also where is that
>> place to file the issue in improving the doc?
>>
>>
>>
>> On Thu, Apr 19, 2012 at 10:22 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>> Hi Vadim,
>>>
>>> Are you up for submitting a pull request on the Flask fastcgi docs?
>>> If not, let's file an issue to use your message here in improving the
>>> doc.
>>> Thanks,
>>>
>>> Ron
>>>
>>>
>>> On Thu, Apr 19, 2012 at 3:56 AM, Vadim Pestovnikov
>>> <vadim.pestovnikov@gmail.com> wrote:
>>>> Hi all,
>>>> Recently I had a problem with deploying my Flask application on my
>>>> shared Hostgator account with Apache and <mod_fastcgid> module which
>>>> is only one option so far. The problem was Apache <mod_rewrite> module
>>>> produced a wrong setting for Flask application, my dispatch.fsgi file
>>>> appeared all the times as a part of URL no matter which RewriteRule I
>>>> tried. Finally I found some ideas in this mailing list, people had
>>>> similar problems.
>>>>
>>>> ***
>>>>
>>>> Here is my .htaccess:
>>>>
>>>> <IfModule mod_fcgid.c>
>>>>    AddHandler fcgid-script .fcgi
>>>>    <Files ~ (\.fcgi)>
>>>>        SetHandler fcgid-script
>>>>        Options +FollowSymLinks +ExecCGI
>>>>    </Files>
>>>> </IfModule>
>>>>
>>>> <IfModule mod_rewrite.c>
>>>>    Options +FollowSymlinks
>>>>    RewriteEngine On
>>>>    RewriteBase /
>>>>    RewriteCond %{REQUEST_FILENAME} !-f
>>>>    RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
>>>> </IfModule>
>>>>
>>>> ***
>>>>
>>>> Here is my dispatch.fsgi:
>>>>
>>>> #!/usr/bin/python
>>>>
>>>> import sys
>>>> sys.path.insert(0, '<your_path>/lib/python2.6/site-packages')
>>>>
>>>> from flup.server.fcgi import WSGIServer
>>>> from yourapplication import app
>>>>
>>>> class ScriptNameStripper(object):
>>>>    to_strip = '/dispatch.fcgi'
>>>>    def __init__(self, app):
>>>>        self.app = app
>>>>    def __call__(self, environ, start_response):
>>>>        environ['SCRIPT_NAME'] = ''
>>>>        return self.app(environ, start_response)
>>>>
>>>> app = ScriptNameStripper(app)
>>>>
>>>> if __name__ == '__main__':
>>>>    WSGIServer(app).run()
>>>>
>>>> ***
>>>>
>>>> That is all.
>>>>
>>>> Similar problems:
>>>>
>>>> 
http://librelist.com/browser//flask/2011/5/4/flask-exposes-file-system-path-when-redirecting-to-add-a-trailing-slash/#a60175a8503107ff8bfa2758714d90fa
>>>>
>>>> 
http://librelist.com/browser//flask/2011/7/22/url-for-problem-in-apache-+-fastcgi/#2bf3cfe2aa7dc9243c63c356e243baf3
>>>>
>>>>
>>>>
>>>> On Tue, Apr 17, 2012 at 9:00 PM, Vadim Pestovnikov
>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>> Well, as I said it is not the Flask issue. I don't think Armin will be
>>>>> happy :) I will replay tomorrow to this mailing list and you guys will
>>>>> decide where to put it. I need some time to monitor my website and
>>>>> make sure that is the stable solution.
>>>>>
>>>>> On Tue, Apr 17, 2012 at 8:51 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>>>>> Issue tracker is here:
>>>>>> https://github.com/mitsuhiko/flask/issues
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Ron
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 17, 2012 at 8:46 PM, Vadim Pestovnikov
>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>> Hi Ron,
>>>>>>> I have found a fix to my issue. You were saying "could you post an
>>>>>>> issue to Flask"
>>>>>>> where is that place. This mailing list or some where else?
>>>>>>>
>>>>>>> Apparently it is not a Flask's issue it is Apache mod-rewrite's issue.
>>>>>>> It just doesn't work well with Flask.
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain 
<ron.duplain@gmail.com> wrote:
>>>>>>>> Hi Vadim,
>>>>>>>>
>>>>>>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>>>>>>> <vadim.pestovnikov@gmail.com> wrote:
>>>>>>>>> I am trying to get my Flask application working on Hostgator shared
>>>>>>>>> account using the Apache FastCGI deployment method. I am having
>>>>>>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>>>>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>>>>>>> www.example.com/dispatch.fcgi/news/.
>>>>>>>>>
>>>>>>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>>>>>>> tell Flask something else?
>>>>>>>>>
>>>>>>>>> Here is my .htacess:
>>>>>>>>>
>>>>>>>>> RewriteEngine On
>>>>>>>>> AddHandler fcgid-script .fcgi
>>>>>>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>>>>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>>>>>>
>>>>>>>>> I tried many variants none of them works for me.
>>>>>>>>
>>>>>>>> Have you seen the doc here?
>>>>>>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>>>>>>
>>>>>>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>>>>>>> you have your deployment working?
>>>>>>>>
>>>>>>>> -Ron
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Best Regards,
>>>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com
>>
>>
>>
>> --
>> Best Regards,
>> Vadim Pestovnikov | vadim.pestovnikov@gmail.com



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-17 @ 16:24
Hi Ron,
Thanks for the link. I have done it already. Next step is to tell
Apache mod_rewrite module how do you I want my dispatch.fcgi file to
behave. Usually it can be done using .htaccess file. That part doesn't
work for me very well. dispatch.fcgi appears all the time in the URL.

On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Hi Vadim,
>
> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> I am trying to get my Flask application working on Hostgator shared
>> account using the Apache FastCGI deployment method. I am having
>> troubles with a getting a right configuration of Apache mod_rewrite
>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>> www.example.com/dispatch.fcgi/news/.
>>
>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>> tell Flask something else?
>>
>> Here is my .htacess:
>>
>> RewriteEngine On
>> AddHandler fcgid-script .fcgi
>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>
>> I tried many variants none of them works for me.
>
> Have you seen the doc here?
> http://flask.pocoo.org/docs/deploying/fastcgi/
>
> If it doesn't clarify the issue, could you post an issue to Flask when
> you have your deployment working?
>
> -Ron



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Ron DuPlain
Date:
2012-04-17 @ 20:18
On Tue, Apr 17, 2012 at 12:24 PM, Vadim Pestovnikov
<vadim.pestovnikov@gmail.com> wrote:
> Thanks for the link. I have done it already. Next step is to tell
> Apache mod_rewrite module how do you I want my dispatch.fcgi file to
> behave. Usually it can be done using .htaccess file. That part doesn't
> work for me very well. dispatch.fcgi appears all the time in the URL.

I personally haven't deployed fastcgi in years, preferring WSGI.  Have
you considered going with mod_wsgi or proxy to a standalone WSGI
server?

-Ron


> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>> Hi Vadim,
>>
>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>> <vadim.pestovnikov@gmail.com> wrote:
>>> I am trying to get my Flask application working on Hostgator shared
>>> account using the Apache FastCGI deployment method. I am having
>>> troubles with a getting a right configuration of Apache mod_rewrite
>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>> www.example.com/dispatch.fcgi/news/.
>>>
>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>> tell Flask something else?
>>>
>>> Here is my .htacess:
>>>
>>> RewriteEngine On
>>> AddHandler fcgid-script .fcgi
>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>
>>> I tried many variants none of them works for me.
>>
>> Have you seen the doc here?
>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>
>> If it doesn't clarify the issue, could you post an issue to Flask when
>> you have your deployment working?
>>
>> -Ron

Re: [flask] Flask FastCGI deployment Apache mod_rewrite trouble

From:
Vadim Pestovnikov
Date:
2012-04-17 @ 20:31
I would love to, but Hostgator (my current hosting provider doesn't
support WSGI in any ways)

On Tue, Apr 17, 2012 at 4:18 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:
> On Tue, Apr 17, 2012 at 12:24 PM, Vadim Pestovnikov
> <vadim.pestovnikov@gmail.com> wrote:
>> Thanks for the link. I have done it already. Next step is to tell
>> Apache mod_rewrite module how do you I want my dispatch.fcgi file to
>> behave. Usually it can be done using .htaccess file. That part doesn't
>> work for me very well. dispatch.fcgi appears all the time in the URL.
>
> I personally haven't deployed fastcgi in years, preferring WSGI.  Have
> you considered going with mod_wsgi or proxy to a standalone WSGI
> server?
>
> -Ron
>
>
>> On Tue, Apr 17, 2012 at 11:39 AM, Ron DuPlain <ron.duplain@gmail.com> wrote:
>>> Hi Vadim,
>>>
>>> On Tue, Apr 17, 2012 at 10:55 AM, Vadim Pestovnikov
>>> <vadim.pestovnikov@gmail.com> wrote:
>>>> I am trying to get my Flask application working on Hostgator shared
>>>> account using the Apache FastCGI deployment method. I am having
>>>> troubles with a getting a right configuration of Apache mod_rewrite
>>>> rules. My dispatch.fcgi file appears in URL all the times e.g.
>>>> www.example.com/dispatch.fcgi/news/.
>>>>
>>>> How can I fix it? Is it because of my mod_rewrite rules or I need to
>>>> tell Flask something else?
>>>>
>>>> Here is my .htacess:
>>>>
>>>> RewriteEngine On
>>>> AddHandler fcgid-script .fcgi
>>>> RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
>>>> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
>>>>
>>>> I tried many variants none of them works for me.
>>>
>>> Have you seen the doc here?
>>> http://flask.pocoo.org/docs/deploying/fastcgi/
>>>
>>> If it doesn't clarify the issue, could you post an issue to Flask when
>>> you have your deployment working?
>>>
>>> -Ron



-- 
Best Regards,
Vadim Pestovnikov | vadim.pestovnikov@gmail.com