---
title: "정적 파일 배포하기"
version: 3.0
locale: ko
source: https://docs.djangoproject.com/ko/3.0/howto/static-files/deployment/
canonical: https://djangodocs.dev/ko/3.0/howto/static-files/deployment/
---
# 정적 파일 배포하기

> **See also**
>
> For an introduction to the use of [`django.contrib.staticfiles`](/ko/3.0/ref/contrib/staticfiles/#module-django.contrib.staticfiles), see
> [정적 파일 관리하기(e.g. 이미지, 자바스크립트, CSS)](/ko/3.0/howto/static-files/).

## 프로덕션에서 정적파일 제공하기

The basic outline of putting static files into production consists of two
steps: run the [`collectstatic`](/ko/3.0/ref/contrib/staticfiles/#django-admin-collectstatic) command when static files change, then
arrange for the collected static files directory ([`STATIC_ROOT`](/ko/3.0/ref/settings/#std-setting-STATIC_ROOT)) to be
moved to the static file server and served. Depending on
[`STATICFILES_STORAGE`](/ko/3.0/ref/settings/#std-setting-STATICFILES_STORAGE), files may need to be moved to a new location
manually or the [`post_process`](/ko/3.0/ref/contrib/staticfiles/#django.contrib.staticfiles.storage.StaticFilesStorage.post_process) method of
the `Storage` class might take care of that.

Of course, as with all deployment tasks, the devil’s in the details. Every
production setup will be a bit different, so you’ll need to adapt the basic
outline to fit your needs. Below are a few common patterns that might help.

### 같은 서버에서 정적파일과 사이트를 제공하기

If you want to serve your static files from the same server that’s already
serving your site, the process may look something like:

- 개발서버로 코드 올리기
- On the server, run [`collectstatic`](/ko/3.0/ref/contrib/staticfiles/#django-admin-collectstatic) to copy all the static files
  into [`STATIC_ROOT`](/ko/3.0/ref/settings/#std-setting-STATIC_ROOT).
- Configure your web server to serve the files in [`STATIC_ROOT`](/ko/3.0/ref/settings/#std-setting-STATIC_ROOT)
  under the URL [`STATIC_URL`](/ko/3.0/ref/settings/#std-setting-STATIC_URL). For example, here’s
  [how to do this with Apache and mod\_wsgi](/ko/3.0/howto/deployment/wsgi/modwsgi/#serving-files).

You’ll probably want to automate this process, especially if you’ve got
multiple web servers.

### 특정 서버에서 정적파일 제공하기

Most larger Django sites use a separate Web server – i.e., one that’s not also
running Django – for serving static files. This server often runs a different
type of web server – faster but less full-featured. Some common choices are:

- [Nginx](https://nginx.org/en/)
- A stripped-down version of [Apache](https://httpd.apache.org/)

Configuring these servers is out of scope of this document; check each
server’s respective documentation for instructions.

Since your static file server won’t be running Django, you’ll need to modify
the deployment strategy to look something like:

- 정적 파일이 수정되었다면, 로컬에서 [`collectstatic`](/ko/3.0/ref/contrib/staticfiles/#django-admin-collectstatic) 를 실행하세요.
- Push your local [`STATIC_ROOT`](/ko/3.0/ref/settings/#std-setting-STATIC_ROOT) up to the static file server into the
  directory that’s being served. [rsync](https://rsync.samba.org/) is a
  common choice for this step since it only needs to transfer the bits of
  static files that have changed.

### 클라우드 서비스나 CDN으로 정적 파일 제공하기

Another common tactic is to serve static files from a cloud storage provider
like Amazon’s S3 and/or a CDN (content delivery network). This lets you
ignore the problems of serving static files and can often make for
faster-loading Web pages (especially when using a CDN).

When using these services, the basic workflow would look a bit like the above,
except that instead of using `rsync` to transfer your static files to the
server you’d need to transfer the static files to the storage provider or CDN.

There’s any number of ways you might do this, but if the provider has an API,
you can use a [custom file storage backend](/ko/3.0/howto/custom-file-storage/)
to integrate the CDN with your Django project. If you’ve written or are using a
3rd party custom storage backend, you can tell [`collectstatic`](/ko/3.0/ref/contrib/staticfiles/#django-admin-collectstatic) to use
it by setting [`STATICFILES_STORAGE`](/ko/3.0/ref/settings/#std-setting-STATICFILES_STORAGE) to the storage engine.

For example, if you’ve written an S3 storage backend in
`myproject.storage.S3Storage` you could use it with:

```
STATICFILES_STORAGE = 'myproject.storage.S3Storage'
```

Once that’s done, all you have to do is run [`collectstatic`](/ko/3.0/ref/contrib/staticfiles/#django-admin-collectstatic) and your
static files would be pushed through your storage package up to S3. If you
later needed to switch to a different storage provider, you may only have to
change your [`STATICFILES_STORAGE`](/ko/3.0/ref/settings/#std-setting-STATICFILES_STORAGE) setting.

For details on how you’d write one of these backends, see
[커스텀 저장 시스템 작성하기](/ko/3.0/howto/custom-file-storage/). There are 3rd party apps available that
provide storage backends for many common file storage APIs. A good starting
point is the [overview at djangopackages.org](https://djangopackages.org/grids/g/storage-backends/).

## Learn more

For complete details on all the settings, commands, template tags, and other
pieces included in [`django.contrib.staticfiles`](/ko/3.0/ref/contrib/staticfiles/#module-django.contrib.staticfiles), see [the
staticfiles reference](/ko/3.0/ref/contrib/staticfiles/).
