Browse Source

๐ŸŒ Add Korean translation for `docs/ko/docs/tutorial/static-files.md` (#2957)

pull/11011/head
Jeesang Kim 1 year ago
committed by GitHub
parent
commit
ea6e0ffdc0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 40
      docs/ko/docs/tutorial/static-files.md

40
docs/ko/docs/tutorial/static-files.md

@ -0,0 +1,40 @@
# ์ •์  ํŒŒ์ผ
'StaticFiles'๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ์ •์  ํŒŒ์ผ์„ ์ž๋™์œผ๋กœ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
## `StaticFiles` ์‚ฌ์šฉ
* `StaticFiles` ์ž„ํฌํŠธํ•ฉ๋‹ˆ๋‹ค.
* ํŠน์ • ๊ฒฝ๋กœ์— `StaticFiles()` ์ธ์Šคํ„ด์Šค๋ฅผ "๋งˆ์šดํŠธ" ํ•ฉ๋‹ˆ๋‹ค.
```Python hl_lines="2 6"
{!../../../docs_src/static_files/tutorial001.py!}
```
!!! note "๊ธฐ์ˆ ์  ์„ธ๋ถ€์‚ฌํ•ญ"
`from starlette.staticfiles import StaticFiles` ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
**FastAPI**๋Š” ๋‹จ์ง€ ๊ฐœ๋ฐœ์ž์ธ, ๋‹น์‹ ์—๊ฒŒ ํŽธ์˜๋ฅผ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด `fastapi.static files` ์™€ ๋™์ผํ•œ `starlett.static files`๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์‚ฌ์‹ค ์ด๊ฒƒ์€ Starlett์—์„œ ์ง์ ‘ ์˜จ ๊ฒƒ์ž…๋‹ˆ๋‹ค.
### "๋งˆ์šดํŒ…" ์ด๋ž€
"๋งˆ์šดํŒ…"์€ ํŠน์ • ๊ฒฝ๋กœ์— ์™„์ „ํžˆ "๋…๋ฆฝ์ ์ธ" ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•˜๋Š”๋ฐ, ๊ทธ ํ›„ ๋ชจ๋“  ํ•˜์œ„ ๊ฒฝ๋กœ์— ๋Œ€ํ•ด์„œ๋„ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.
๋งˆ์šดํŠธ๋œ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์€ ์™„์ „ํžˆ ๋…๋ฆฝ์ ์ด๊ธฐ ๋•Œ๋ฌธ์— `APIRouter`๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๊ณผ๋Š” ๋‹ค๋ฆ…๋‹ˆ๋‹ค. OpenAPI ๋ฐ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์˜ ๋ฌธ์„œ๋Š” ๋งˆ์šดํŠธ๋œ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ๋“ฑ์—์„œ ์–ด๋–ค ๊ฒƒ๋„ ํฌํ•จํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
์ž์„ธํ•œ ๋‚ด์šฉ์€ **์ˆ™๋ จ๋œ ์‚ฌ์šฉ์ž ์•ˆ๋‚ด์„œ**์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
## ์„ธ๋ถ€์‚ฌํ•ญ
์ฒซ ๋ฒˆ์งธ `"/static"`์€ ์ด "ํ•˜์œ„ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ"์ด "๋งˆ์šดํŠธ"๋  ํ•˜์œ„ ๊ฒฝ๋กœ๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ `"/static"`์œผ๋กœ ์‹œ์ž‘ํ•˜๋Š” ๋ชจ๋“  ๊ฒฝ๋กœ๋Š” `"/static"`์œผ๋กœ ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค.
`'directory="static"`์€ ์ •์  ํŒŒ์ผ์ด ๋“ค์–ด ์žˆ๋Š” ๋””๋ ‰ํ† ๋ฆฌ์˜ ์ด๋ฆ„์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
`name="static"`์€ **FastAPI**์—์„œ ๋‚ด๋ถ€์ ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ด๋ฆ„์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
์ด ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” "`static`"๊ณผ ๋‹ค๋ฅผ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์‚ฌ์šฉ์ž ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์˜ ์š”๊ตฌ ์‚ฌํ•ญ ๋ฐ ๊ตฌ์ฒด์ ์ธ ์„ธ๋ถ€ ์ •๋ณด์— ๋”ฐ๋ผ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์กฐ์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
## ์ถ”๊ฐ€ ์ •๋ณด
์ž์„ธํ•œ ๋‚ด์šฉ๊ณผ ์„ ํƒ ์‚ฌํ•ญ์„ ๋ณด๋ ค๋ฉด <a href="https://www.starlette.io/staticfiles/" class="external-link" target="_blank">Starlette์˜ ์ •์  ํŒŒ์ผ์— ๊ด€ํ•œ ๋ฌธ์„œ</a>๋ฅผ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.
Loadingโ€ฆ
Cancel
Save