Wei Li
2014-10-20 02:33:23 UTC
Hi,
I almost finish my first small project with bottle.py. Everything is going
very well with standalone bottle build-in web server. But I have problem
when deploy it.
In my code, I use redirect to route like:
redirect("/index?%s=%s" % (arg1, value1))
This will not work if the application is not deployed at the root of the
site. For example, if application is installed at
http://www.test.com/app/myapp.py the redirect doesn't know that it should
add "app" as prefix.
Then I changed my code to use get_url
redirect(myapp.get_url("/index"), arg1 = value1)
This works perfect. However, if the route is dynamic, get_url doesn't
work... See below
@route("/hello<name>)
def hello(name):
....
pass
def test():
redirect(myapp.get_url("/hello/%s"%name)) #this doesn't work!
Is there anyway to get the real url for a dynamic route?
Thanks,
Wei
--
I almost finish my first small project with bottle.py. Everything is going
very well with standalone bottle build-in web server. But I have problem
when deploy it.
In my code, I use redirect to route like:
redirect("/index?%s=%s" % (arg1, value1))
This will not work if the application is not deployed at the root of the
site. For example, if application is installed at
http://www.test.com/app/myapp.py the redirect doesn't know that it should
add "app" as prefix.
Then I changed my code to use get_url
redirect(myapp.get_url("/index"), arg1 = value1)
This works perfect. However, if the route is dynamic, get_url doesn't
work... See below
@route("/hello<name>)
def hello(name):
....
pass
def test():
redirect(myapp.get_url("/hello/%s"%name)) #this doesn't work!
Is there anyway to get the real url for a dynamic route?
Thanks,
Wei
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.