Andy Salnikov
2015-07-02 22:11:33 UTC
Hi,
I have split my large bottle app into few smaller apps which are all
mounted under root app. Now in one of the apps I want to generate URL for
the resource served by other app and that does not see m to work:
# actual applications live in separate files, here for simplicity it's all
together
app1 = Bottle()
app2 = Bottle()
app = Bottle()
app.mount('/app1', app1)
app.mount('/app2', app2)
@app1.route('/nice_plot/<name>', name='nice_plot')
def nice_plot(name):
return SomeData()
@app2.route('/plot_grid')
def plot_grid():
# and here I want to generate URL served by app1, e.g.
'/app1/nice_plot/123'
# tried this:
url = app1.get_url('nice_plot', name='123')
# but it returns '/app2/nice_plot/123' instead
Looking at how get_url() is implemented it's clear why it happens (it uses
SCRIPT_NAME to get URL prefix). Still I need to somehow make correct URL.
Is there a reasonably simple way to do what I want or should I abandon my
idea and hardcode URLs?
Thanks,
Andy
--
I have split my large bottle app into few smaller apps which are all
mounted under root app. Now in one of the apps I want to generate URL for
the resource served by other app and that does not see m to work:
# actual applications live in separate files, here for simplicity it's all
together
app1 = Bottle()
app2 = Bottle()
app = Bottle()
app.mount('/app1', app1)
app.mount('/app2', app2)
@app1.route('/nice_plot/<name>', name='nice_plot')
def nice_plot(name):
return SomeData()
@app2.route('/plot_grid')
def plot_grid():
# and here I want to generate URL served by app1, e.g.
'/app1/nice_plot/123'
# tried this:
url = app1.get_url('nice_plot', name='123')
# but it returns '/app2/nice_plot/123' instead
Looking at how get_url() is implemented it's clear why it happens (it uses
SCRIPT_NAME to get URL prefix). Still I need to somehow make correct URL.
Is there a reasonably simple way to do what I want or should I abandon my
idea and hardcode URLs?
Thanks,
Andy
--
--
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.