There is a small statistical site, in 2-3 pages. Translated into Python . Now I don’t understand how to set up routing to make images, fonts, etc. connected without problems

 #!/usr/bin/env python3 from bottle import route, run, template, static_file @route('/') def index(): return static_file(filename='index.php', root='/var/www/domains/site.com/') @route('/foobar') def index(): return static_file(filename='index.php', root='/var/www/domains/site.com/foobar') run(host='ip', port=4444) 

in html , as usual, the path to connect the file is specified, for example:

 <html> <body> <img src='http://site.com/img/img.jpg' /> </body> </html> 

    1 answer 1

    Thank! It dawned on me that you just need to route every directory with files:

     @route('/img/<filename>') def send_image(filename): return static_file(filename, root='/var/www/domains/site.com/img',)