Is it possible to use the configuration APPLICATION_ROOT while developing on localhost? I have successfully used it on a shared domain where I only have access to a sub path of a domain, however, when I configure my application with, SERVER_NAME = 'localhost:5000' APPLICATION_ROOT = "/myapp" I get 404 for any path whether it has the "myapp" root or not. Thank you, Ryan
Hi, On Sun, Jan 29, 2012 at 9:16 PM, Ryan Hsu <ryanlives@gmail.com> wrote: > Is it possible to use the configuration APPLICATION_ROOT while developing on localhost? I have successfully used it on a shared domain where I only have access to a sub path of a domain, however, when I configure my application with, > > SERVER_NAME = 'localhost:5000' > APPLICATION_ROOT = "/myapp" > > I get 404 for any path whether it has the "myapp" root or not. APPLICATION_ROOT only applies to sessions, that is, cookies. The wsgi/http container is responsible for the routing. To get the same effect in development, you'll need to add a wsgi application dispatcher like this: https://gist.github.com/1705072 Hope this helps, Ron
Actually, that's what I thought initially, but on my server, a call to
url_for('index') shows up with the APPLICATION_ROOT prefix. This has
to be Flask's doing right? The only other thing I can think of that
would alter the URL would be setting WSGIScriptAlias in my Apache
config but as far as I've read it doesn't seem like it is capable of
transforming URLs like that (can it?).
On 1/30/12, Ron DuPlain <ron.duplain@gmail.com> wrote:
> Hi,
>
> On Sun, Jan 29, 2012 at 9:16 PM, Ryan Hsu <ryanlives@gmail.com> wrote:
>> Is it possible to use the configuration APPLICATION_ROOT while developing
>> on localhost? I have successfully used it on a shared domain where I only
>> have access to a sub path of a domain, however, when I configure my
>> application with,
>>
>> SERVER_NAME = 'localhost:5000'
>> APPLICATION_ROOT = "/myapp"
>>
>> I get 404 for any path whether it has the "myapp" root or not.
>
> APPLICATION_ROOT only applies to sessions, that is, cookies. The
> wsgi/http container is responsible for the routing. To get the same
> effect in development, you'll need to add a wsgi application
> dispatcher like this:
>
> https://gist.github.com/1705072
>
> Hope this helps,
>
> Ron
>
On Mon, Jan 30, 2012 at 2:54 PM, Ryan Hsu <ryanlives@gmail.com> wrote: > Actually, that's what I thought initially, but on my server, a call to > url_for('index') shows up with the APPLICATION_ROOT prefix. This has > to be Flask's doing right? The only other thing I can think of that > would alter the URL would be setting WSGIScriptAlias in my Apache > config but as far as I've read it doesn't seem like it is capable of > transforming URLs like that (can it?). url_for picks this up from SCRIPT_NAME in the wsgi environ. APPLICATION_ROOT does not affect url_for. -Ron > On 1/30/12, Ron DuPlain <ron.duplain@gmail.com> wrote: >> Hi, >> >> On Sun, Jan 29, 2012 at 9:16 PM, Ryan Hsu <ryanlives@gmail.com> wrote: >>> Is it possible to use the configuration APPLICATION_ROOT while developing >>> on localhost? I have successfully used it on a shared domain where I only >>> have access to a sub path of a domain, however, when I configure my >>> application with, >>> >>> SERVER_NAME = 'localhost:5000' >>> APPLICATION_ROOT = "/myapp" >>> >>> I get 404 for any path whether it has the "myapp" root or not. >> >> APPLICATION_ROOT only applies to sessions, that is, cookies. The >> wsgi/http container is responsible for the routing. To get the same >> effect in development, you'll need to add a wsgi application >> dispatcher like this: >> >> https://gist.github.com/1705072 >> >> Hope this helps, >> >> Ron >>