How can you define static files like CSS and JavaScript in Flask?

How can you define static files like CSS and JavaScript in Flask?

a) By creating a folder named “static” in the project directory
b) By placing the files in the root directory
c) By using the Flask-WTF extension
d) By embedding the files directly in the HTML

Answer:

a) By creating a folder named “static” in the project directory

Explanation:

In Flask, static files such as CSS and JavaScript are typically placed in a directory named static in the project folder, and Flask serves them from this directory.

Reference:

Flask Quiz – MCQ Questions and Answers

Scroll to Top