user505160
user505160

Reputation: 1216

Tornado static files serving url configuration

I configured torando for serving static files for development purposes.

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

Inside my template files I am using static_url() to give proper path to my static files.

Because my html files have structure of static files already defined tornado static_url isn't showing correct path.

For example, on my server file is having url like

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

and after using static_url it is

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

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

Upvotes: 1

Views: 2107

Answers (1)

Ben Darnell
Ben Darnell

Reputation: 22134

You want static_url_prefix (which replaces /static/ at the front of the url) instead of static_path (which is the location on disk where the static files are stored).

Upvotes: 2

Related Questions