๐จ๐ผ๐ป๊ฐ๋ฐ/ํ์ด์ฌ
Flask - static ํ์ผ๋ค ์ ๊ณตํ๊ธฐ
Janger
2021. 12. 8. 08:47
728x90
from flask import Flask, request, send_from_directory
# set the project root directory as the static folder, you can set others.
app = Flask(__name__, static_url_path='')
@app.route('/js/<path:path>')
def send_js(path):
return send_from_directory('js', path)
if __name__ == "__main__":
app.run()
์ถ์ฒ:
https://stackoverflow.com/questions/20646822/how-to-serve-static-files-in-flask
How to serve static files in Flask
So this is embarrassing. I've got an application that I threw together in Flask and for now it is just serving up a single static HTML page with some links to CSS and JS. And I can't find where in ...
stackoverflow.com
728x90