Static file configuration

Configuration
of static files A large number of static files will appear in Web applications to make the page more dynamic and beautiful. Static resources such as CSS style files, JavaScript script files, graphic files, font files, etc. Loading static files in Jinja is often simple, just by using the url_for global function.

By default, the url_for function will look for about.css files in the static folder under the project root directory. If found, it will form a /static/about.css path relative to the project root directory. Of course, we can also put static files in the static folder. At this time, we need to specify
app = Flask ( name , static_folder = 'C: \ static')
Then when accessing static files, we will arrive Look under the / static folder.

Published 118 original articles · won praise 0 · Views 2659

Guess you like

Origin blog.csdn.net/weixin_45905671/article/details/105570369