question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_url across mount points

See original GitHub issue
app/
    app.py
    modules/
        mod1/
            mod1.py
            views/
                view1.html
        mod2/
            mod2.py
            views/
                view2.html

app.py

root = Bottle()
root.mount ("/mod1", mod1app)
root.mount ("/mod2", mod2app)

Question: can I use get_url from a template, to get a URL from any module? For example

view1.html

{{  get_url ("root.about")  }}
{{  get_url ("mod1.articles")  }}
{{  get_url ("mod2.shop")  }}

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
wonkydonkycommented, Mar 22, 2018

Oh, you’re right. The answer is no. I’d like to suggest this feature though.

1reaction
wonkydonkycommented, Mar 22, 2018

Ideally, I think it should work like this

root = Bottle()

mod1 = Bottle(name='mod1')
mod2 = Bottle(name='mod2')

root.mount ("/mod1", mod1)
root.mount ("/mod2", mod2)

bottle.BaseTemplate.defaults['get_url'] = root.get_url

and used like this from a template

{{ get_url('about') }}        <-    get "about" route from base app
{{ get_url('mod1.user') }}    <-    get "user" route from mod1 app

If this functionality could be added to Bottle, I think it would be great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to get url of an object in cherrypy? - Stack Overflow
You can access to the mounted apps through cherrypy.tree.apps[mount_point].root. root is always the mounted instance to the mount point.
Read more >
Accessing contents on the underlying mount point path
In Linux, you can use a bind mount to remount part of the file hierarchy somewhere else. So, for example, you could do:...
Read more >
File Storage - Laravel - The PHP Framework For Web Artisans
Utilizing this folder convention will keep your publicly accessible files in one directory that can be easily shared across deployments when using zero...
Read more >
Chapter 29. Sharing a mount on multiple mount points
This procedure duplicates a mount point as a slave mount type. File systems that you later mount under the original mount point are...
Read more >
Files homepage only "Some of the configured external mount ...
External storage share should be accessible via the web interface. Actual behaviour. I get a “Some of the configured external mount points are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found