{"title":"정적 파일 배포하기","version":"3.2","locale":"ko","docname":"howto/static-files/deployment","url":"/ko/3.2/howto/static-files/deployment/","canonical":"https://djangodocs.dev/ko/3.2/howto/static-files/deployment/","summary":"더 보기 :mod:’django.contrib.static files’의 사용에 대한 자세한 내용은 :doc:’/how to/static files/index’를 참조하십시오. 프로덕션에서 정적파일 제공하기 Link to this heading # 정적 파일을 프로덕션에 넣는 기본 개요는 두…","html":"<h1>정적 파일 배포하기<a class=\"heading-anchor\" href=\"#deploying-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>정적 파일을 프로덕션에 넣는 기본 개요는 두 단계로 구성됩니다. 정적 파일이 변경될 때 :djadmin:’collectstatic’ 명령을 실행한 다음 수집된 정적 파일 디렉토리(:seting:’).STATIC_ROOT’)를 정적 파일 서버로 이동하여 제공합니다. : 설정에 따라 달라집니다.STATICFILES_STORY’에서 파일을 수동으로 새 위치로 이동하거나 :func:’post_process &lt;django.contrib.staticfiles.staticfiles.storage로 이동해야 할 수 있습니다.정적 파일 저장소입니다.포스트_프로세스’ 방식의 스토리지 클래스가 이를 해결할 수도 있습니다.</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/3.2/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>여러 가지 방법을 사용할 수 있지만 제공자에 API가 있는 경우 :doc:’사용자 정의 파일 스토리지 백엔드를 사용하여 CDN을 Django 프로젝트와 통합할 수 있습니다. 타사 사용자 지정 스토리지 백엔드를 작성했거나 사용 중인 경우 :djadmin:’collectstatic’을 설정하여 사용할 수 있습니다.static files_storage’를 저장 엔진에 연결합니다.</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\">STATICFILES_STORAGE</span> <span class=\"o\">=</span> <span class=\"s1\">&#39;myproject.storage.S3Storage&#39;</span>\n</code></pre></div>\n<p>작업이 완료되면 djadmin:’collectstatic’만 실행하면 정적 파일이 스토리지 패키지를 통해 S3까지 푸시됩니다. 나중에 다른 스토리지 제공자로 전환해야 하는 경우 :seting:’만 변경하면 됩니다.정적 파일_저장소’ 설정입니다.</p>\n<p>백엔드를 작성하는 방법에 대한 자세한 내용은:doc:’/how to/custom-file-storage’를 참조하십시오. 많은 공통 파일 스토리지 API에 대한 스토리지 백엔드를 제공하는 타사 앱이 있습니다. 좋은 출발점이 바로 djangopackages.org입니다.</p>\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":"deploying-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/3.2/howto/"}],"prev":{"docname":"howto/static-files/index","title":"정적 파일 관리하기(e.g. 이미지, 자바스크립트, CSS)","url":"/ko/3.2/howto/static-files/"},"next":{"docname":"howto/windows","title":"윈도우즈에 Django 설치하기","url":"/ko/3.2/howto/windows/"},"formats":{"html":"/ko/3.2/howto/static-files/deployment/","markdown":"/ko/3.2/howto/static-files/deployment.md","json":"/ko/3.2/howto/static-files/deployment.json"},"source":"https://github.com/django/django/blob/stable/3.2.x/docs/howto/static-files/deployment.txt","official":"https://docs.djangoproject.com/ko/3.2/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"]}