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
๋ฐ์ํ
'๐จ๐ผโ๐ป๊ฐ๋ฐ > ํ์ด์ฌ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
ํ์ด์ฌ - ini ์ค์ ํ์ผ ๋ถ๋ฌ์ค๊ธฐ (0) | 2022.05.08 |
---|---|
ํ์ด์ฌ - ์ค๋ ๋ ์๊ด ์์ด ํ๋ก๊ทธ๋จ ์์ ์ข ๋ฃ (0) | 2022.05.07 |
ํ์ด์ฌ - Cloudflare ์ฐํํ์ฌ ํฌ๋กค๋งํ๊ธฐ (0) | 2022.01.29 |
ํ์ด์ฌ - base64๋ฅผ ์ด๋ฏธ์ง ํ์ผ๋ก ์ ์ฅํ๊ธฐ (0) | 2021.12.08 |
ํ์ด์ฌ - ์ฌ๋ฌ๊ฐ์ ๋ฌธ์์ด ๋ณ๊ฒฝํ๊ธฐ (0) | 2021.12.08 |