Home  >  Q&A  >  body text

python - Issues about flask static file configuration 404

I placed a static under the root directory of the project and wrote a simple route to test access, but it always got 404

The project structure is as follows:

The code of views.py is as follows:


Could you please give me some guidance? The permissions of the file have been set to 777

習慣沉默習慣沉默2735 days ago648

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-05-18 10:58:06

    Routes for static directories will not be registered by default when blueprint objects are created. We need to specify the static_folder parameter when creating.

    reply
    0
  • 高洛峰

    高洛峰2017-05-18 10:58:06

    Create a new templates directory in the root directory, and then drop your template files into it. And what you set is static, which is only used to store static files, such as css and javascript files.

    reply
    0
  • Cancelreply