Tornado Static Files Serving URL Configuration

I configured torando to serve static files for development purposes.

settings = { 'template_path': 'templates', 'static_path': 'static' } 

Inside my template files, I use static_url () to indicate the correct path to my static files.

Since my html files have a static file structure, the already defined tornado static_url does not show the correct path.

For example, on my server the file has a url like

 <link href="/myflz/resources/css/bootstrap.css" rel="stylesheet"/> 

and after using static_url it

 <link href="/static/myflz/resources/css/bootstrap.css" rel="stylesheet"/> 

How can I get rid of static to myflz because changing static_path: static to static_path: myflz doesn't work, it still uses the statics in front.

+1
python tornado
source share
1 answer

You want static_url_prefix (which replaces /static/ at the beginning of the URL) instead of static_path (this is the disk space where the static files are stored).

+2
source share

All Articles