I don’t know what effect django.views.static.serve is. I hope the following content will be helpful to you.
In the Flask development environment, I mainly use the following two methods to access static files:
【Method 1】
Put the static files in the static directory. For example, if the application has a static file in the css/style.css directory, it can be accessed through the /static/css/style.css URL.
【Method 2】
Use the send_from_directory function. For example:
The first parameter is the directory, which can be specified flexibly. The static directory is used here for convenience; the second parameter is the file name. See the documentation for more details.
I don’t know what effect
django.views.static.serve
is. I hope the following content will be helpful to you.In the Flask development environment, I mainly use the following two methods to access static files:
【Method 1】
Put the static files in the
static
directory. For example, if the application has astatic
file in thecss/style.css
directory, it can be accessed through the/static/css/style.css
URL.【Method 2】
Use the
send_from_directory
function. For example:The first parameter is the directory, which can be specified flexibly. The static directory is used here for convenience; the second parameter is the file name. See the documentation for more details.