{"title":"정적 파일을 배포하는 방법","version":"5.0","locale":"ko","docname":"howto/static-files/deployment","url":"/ko/5.0/howto/static-files/deployment/","canonical":"https://djangodocs.dev/ko/5.0/howto/static-files/deployment/","summary":"더 보기 :mod:’django.contrib.static files’의 사용에 대한 자세한 내용은 :doc:’/how to/static files/index’를 참조하십시오. 프로덕션에서 정적파일 제공하기 Link to this heading # The basic outline of…","html":"<h1>정적 파일을 배포하는 방법<a class=\"heading-anchor\" href=\"#how-to-deploy-static-files\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<aside class=\"admonition admonition-seealso\">\n<p class=\"admonition-title\">더 보기</p>\n<p>:mod:’django.contrib.static files’의 사용에 대한 자세한 내용은 :doc:’/how to/static files/index’를 참조하십시오.</p>\n</aside>\n<section id=\"serving-static-files-in-production\">\n<span id=\"staticfiles-production\"></span><h2>프로덕션에서 정적파일 제공하기<a class=\"heading-anchor\" href=\"#serving-static-files-in-production\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>The basic outline of putting static files into production consists of two\nsteps: run the <a class=\"reference internal\" href=\"/ko/5.0/ref/contrib/staticfiles/#django-admin-collectstatic\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">collectstatic</span></code></a> command when static files change, then\narrange for the collected static files directory (<a class=\"reference internal\" href=\"/ko/5.0/ref/settings/#std-setting-STATIC_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATIC_ROOT</span></code></a>) to be\nmoved to the static file server and served. Depending the <code class=\"docutils literal notranslate\"><span class=\"pre\">staticfiles</span></code>\n<a class=\"reference internal\" href=\"/ko/5.0/ref/settings/#std-setting-STORAGES\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STORAGES</span></code></a> alias, files may need to be moved to a new location\nmanually or the <a class=\"reference internal\" href=\"/ko/5.0/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.StaticFilesStorage.post_process\" title=\"django.contrib.staticfiles.storage.StaticFilesStorage.post_process\"><code class=\"xref py py-func docutils literal notranslate\"><span class=\"pre\">post_process</span></code></a> method of\nthe <code class=\"docutils literal notranslate\"><span class=\"pre\">Storage</span></code> class might take care of that.</p>\n<p>모든 배포 작업과 마찬가지로 세부 사항도 중요합니다. 모든 프로덕션 설정은 약간 다르므로 필요에 맞게 기본 개요를 조정해야 합니다. 다음은 도움이 될 수 있는 몇 가지 일반적인 패턴입니다.</p>\n<section id=\"serving-the-site-and-your-static-files-from-the-same-server\">\n<h3>같은 서버에서 정적파일과 사이트를 제공하기<a class=\"heading-anchor\" href=\"#serving-the-site-and-your-static-files-from-the-same-server\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>사이트에 이미 서비스를 제공하고 있는 서버와 동일한 서버에서 정적 파일을 제공하려는 경우 프로세스는 다음과 같을 수 있습니다.</p>\n<ul class=\"simple\">\n<li><p>개발서버로 코드 올리기</p></li>\n<li><p>서버에서 :djadmin:’collectstatic’을 실행하여 모든 정적 파일을 :seting:’에 복사합니다.STATIC_ROOT’입니다.</p></li>\n<li><p>:seting:’에서 파일을 서비스하도록 웹 서버를 구성합니다.URL의 STATIC_ROOT’ 아래에 있습니다. 설정:’:’STATIC_URL’입니다. 예를 들어 다음과 같습니다.Apache 및 mod_wsgi로 이 작업을 수행하는 방법입니다.</p></li>\n</ul>\n<p>특히 웹 서버가 여러 개인 경우 이 프로세스를 자동화할 수 있습니다.</p>\n</section>\n<section id=\"serving-static-files-from-a-dedicated-server\">\n<h3>특정 서버에서 정적파일 제공하기<a class=\"heading-anchor\" href=\"#serving-static-files-from-a-dedicated-server\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>대부분의 대형 Django 사이트에서는 정적 파일을 처리하기 위해 별도의 웹 서버(예: Django를 실행하지 않는 서버)를 사용합니다. 이 서버는 종종 다른 유형의 웹 서버를 실행하며 속도는 빠르지만 기능은 부족합니다. 일반적인 선택은 다음과 같습니다:</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference external\" href=\"https://nginx.org/en/\">Nginx</a></p></li>\n<li><p>Apache_의 stripped-down 버전</p></li>\n</ul>\n<p>이 서버 구성은 이 문서의 범위를 벗어납니다. 각 서버의 해당 문서에서 지침을 확인하십시오.</p>\n<p>정적 파일 서버가 Django를 실행하지 않으므로 다음과 같이 배포 전략을 수정해야 합니다.</p>\n<ul class=\"simple\">\n<li><p>정적 파일이 수정되었다면, 로컬에서 <a class=\"reference internal\" href=\"/ko/5.0/ref/contrib/staticfiles/#django-admin-collectstatic\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">collectstatic</span></code></a> 를 실행하세요.</p></li>\n<li><p>로컬:설정:’를 누릅니다.STATIC_ROOT’을(를) 정적 파일 서버에 올려서 서비스 중인 디렉토리에 넣습니다. ‘rsync <a class=\"reference external\" href=\"https://rsync.samba.org/\">https://rsync.samba.org/</a>’_은(는) 변경된 정적 파일의 비트만 전송하면 되기 때문에 이 단계에서 흔히 선택할 수 있습니다.</p></li>\n</ul>\n</section>\n<section id=\"serving-static-files-from-a-cloud-service-or-cdn\">\n<span id=\"staticfiles-from-cdn\"></span><h3>클라우드 서비스나 CDN으로 정적 파일 제공하기<a class=\"heading-anchor\" href=\"#serving-static-files-from-a-cloud-service-or-cdn\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>또 다른 일반적인 방법은 Amazon의 S3 및/또는 CDN(컨텐츠 제공 네트워크)과 같은 클라우드 스토리지 공급업체의 정적 파일을 제공하는 것입니다. 이렇게 하면 정적 파일 서비스 문제를 무시할 수 있으며 웹 페이지를 더 빨리 로드할 수 있습니다(특히 CDN 사용 시).</p>\n<p>이러한 서비스를 사용할 때 기본 워크플로우는 위와 약간 비슷하지만 서버에 정적 파일을 전송하기 위해 “rsync”를 사용하는 대신 정적 파일을 스토리지 공급자 또는 CDN으로 전송해야 한다는 점을 제외하면 그렇습니다.</p>\n<p>There’s any number of ways you might do this, but if the provider has an API,\nyou can use a <a class=\"reference internal\" href=\"/ko/5.0/howto/custom-file-storage/\"><span class=\"doc\">custom file storage backend</span></a>\nto integrate the CDN with your Django project. If you’ve written or are using a\n3rd party custom storage backend, you can tell <a class=\"reference internal\" href=\"/ko/5.0/ref/contrib/staticfiles/#django-admin-collectstatic\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">collectstatic</span></code></a> to use\nit by setting <code class=\"docutils literal notranslate\"><span class=\"pre\">staticfiles</span></code> in <a class=\"reference internal\" href=\"/ko/5.0/ref/settings/#std-setting-STORAGES\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STORAGES</span></code></a>.</p>\n<p>예를 들어 “myproject.storage”에 S3 스토리지 백엔드를 작성한 경우입니다.S3Storage는 다음과 같은 용도로 사용할 수 있습니다.</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">STORAGES</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"c1\"># ...</span>\n    <span class=\"s2\">&quot;staticfiles&quot;</span><span class=\"p\">:</span> <span class=\"p\">{</span><span class=\"s2\">&quot;BACKEND&quot;</span><span class=\"p\">:</span> <span class=\"s2\">&quot;myproject.storage.S3Storage&quot;</span><span class=\"p\">}</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n<p>Once that’s done, all you have to do is run <a class=\"reference internal\" href=\"/ko/5.0/ref/contrib/staticfiles/#django-admin-collectstatic\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">collectstatic</span></code></a> and your\nstatic files would be pushed through your storage package up to S3. If you\nlater needed to switch to a different storage provider, you may only have to\nchange <code class=\"docutils literal notranslate\"><span class=\"pre\">staticfiles</span></code> in the <a class=\"reference internal\" href=\"/ko/5.0/ref/settings/#std-setting-STORAGES\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STORAGES</span></code></a> setting.</p>\n<p>백엔드를 작성하는 방법에 대한 자세한 내용은:doc:’/how to/custom-file-storage’를 참조하십시오. 많은 공통 파일 스토리지 API에 대한 스토리지 백엔드를 제공하는 타사 앱이 있습니다. 좋은 출발점이 바로 djangopackages.org입니다.</p>\n<aside class=\"version-note version-changed\" data-version=\"4.2\">\n<p class=\"version-note-title\">Changed in Django 4.2</p><p>The <a class=\"reference internal\" href=\"/ko/5.0/ref/settings/#std-setting-STORAGES\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STORAGES</span></code></a> setting was added.</p>\n</aside>\n</section>\n</section>\n<section id=\"learn-more\">\n<h2>추가사항<a class=\"heading-anchor\" href=\"#learn-more\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>:mod:’django.contrib.static files’에 포함된 모든 설정, 명령, 템플릿 태그 및 기타 항목에 대한 자세한 내용은 :doc:’static files reference’를 참조하십시오.</p>\n</section>","rootId":"how-to-deploy-static-files","toc":[{"title":"프로덕션에서 정적파일 제공하기","anchor":"serving-static-files-in-production","children":[{"title":"같은 서버에서 정적파일과 사이트를 제공하기","anchor":"serving-the-site-and-your-static-files-from-the-same-server","children":[]},{"title":"특정 서버에서 정적파일 제공하기","anchor":"serving-static-files-from-a-dedicated-server","children":[]},{"title":"클라우드 서비스나 CDN으로 정적 파일 제공하기","anchor":"serving-static-files-from-a-cloud-service-or-cdn","children":[]}]},{"title":"추가사항","anchor":"learn-more","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"“How-to” 가이드","url":"/ko/5.0/howto/"}],"prev":{"docname":"howto/static-files/index","title":"정적 파일 관리하기(이미지, 자바스크립트, CSS 등)","url":"/ko/5.0/howto/static-files/"},"next":{"docname":"howto/windows","title":"윈도우즈에 Django 설치하기","url":"/ko/5.0/howto/windows/"},"formats":{"html":"/ko/5.0/howto/static-files/deployment/","markdown":"/ko/5.0/howto/static-files/deployment.md","json":"/ko/5.0/howto/static-files/deployment.json"},"source":"https://github.com/django/django/blob/stable/5.0.x/docs/howto/static-files/deployment.txt","official":"https://docs.djangoproject.com/ko/5.0/howto/static-files/deployment/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11"],"inLocales":["en","zh-hans","fr","ja","id","it","pt-br","ko","es","el","pl"]}