{"title":"자주 묻는 질문: 장고 사용하기","version":"3.2","locale":"ko","docname":"faq/usage","url":"/ko/3.2/faq/usage/","canonical":"https://djangodocs.dev/ko/3.2/faq/usage/","summary":"왜 DJANGO_SETTINGS_MODULE를 import하는데 에러가 발생하나요? Link to this heading # 꼭 확인하세요. The environment variable DJANGO_SETTINGS_MODULE is set to a fully-qualified Python…","html":"<h1>자주 묻는 질문: 장고 사용하기<a class=\"heading-anchor\" href=\"#faq-using-django\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<section id=\"why-do-i-get-an-error-about-importing-django-settings-module\">\n<h2>왜 DJANGO_SETTINGS_MODULE를 import하는데 에러가 발생하나요?<a class=\"heading-anchor\" href=\"#why-do-i-get-an-error-about-importing-django-settings-module\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>꼭 확인하세요.</p>\n<ul class=\"simple\">\n<li><p>The environment variable <span class=\"target\" id=\"index-1\"></span><a class=\"reference internal\" href=\"/ko/3.2/topics/settings/#envvar-DJANGO_SETTINGS_MODULE\"><code class=\"xref std std-envvar docutils literal notranslate\"><span class=\"pre\">DJANGO_SETTINGS_MODULE</span></code></a> is set to a\nfully-qualified Python module (i.e. “mysite.settings”).</p></li>\n<li><p>모듈이 <a href=\"#id1\"><span class=\"problematic\" id=\"id2\">``</span></a>sys.path``에 있다고 합시다.( <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>import mysite.settings``는 작동할 것입니다.)</p></li>\n<li><p>모듈은 문법오류를 포함하지 않습니다.</p></li>\n</ul>\n</section>\n<section id=\"i-can-t-stand-your-template-language-do-i-have-to-use-it\">\n<h2>당신의 템플릿 언어를 못견디겠습니다. 이걸 써야 하나요?<a class=\"heading-anchor\" href=\"#i-can-t-stand-your-template-language-do-i-have-to-use-it\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>chunky bacon이후로 저희들은 저희 템플릿 엔진이 최고라고 생각해 왔습니다, 하지만 템플릿 언어를 고른다는 것은 종교에 가깝다는 것을 깨달았습니다. 장고는 어떤 템플릿 언어를 요구하지 않습니다. 따라서 Jinja2, Mako 같은 어떤것이라도 자유롭게 사용하실 수 있습니다.</p>\n</section>\n<section id=\"do-i-have-to-use-your-model-database-layer\">\n<h2>모델/데이터베이스 계층을 사용해야 하나요?<a class=\"heading-anchor\" href=\"#do-i-have-to-use-your-model-database-layer\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>아니요. 템플릿 시스템과 같이, 모델/데이터베이스 계층은 나머지 프레임워크와 떼어놓을 수 있습니다.</p>\n<p>한 가지 예외사항은, 만약 다른 데이터베이스 라이브러리를 사용한다면, 장고가 자동으로 만드는 관리자 사이트를 사용하지 못할 것입니다. 이 앱은 장고 데이터베이스 계층과 연결되어 있기 때문입니다.</p>\n</section>\n<section id=\"how-do-i-use-image-and-file-fields\">\n<h2>어떻게 이미지나 파일 필드를 사용할 수 있나요?<a class=\"heading-anchor\" href=\"#how-do-i-use-image-and-file-fields\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p><a class=\"reference internal\" href=\"/ko/3.2/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">FileField</span></code></a> 를 사용하거나, 모델의 <a class=\"reference internal\" href=\"/ko/3.2/ref/models/fields/#django.db.models.ImageField\" title=\"django.db.models.ImageField\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">ImageField</span></code></a> 를 사용하면 간단한 과정입니다.</p>\n<ol class=\"arabic simple\">\n<li><p>당신의 설정 파일에, 장고가 업로드 할 디렉토리의 전체 경로를 <code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">MEDIA_ROOT`에</span> <span class=\"pre\">정의해야</span> <span class=\"pre\">합니다.</span> <span class=\"pre\">(</span> <span class=\"pre\">성능을</span> <span class=\"pre\">위해서</span> <span class=\"pre\">이</span> <span class=\"pre\">파일들은</span> <span class=\"pre\">데이터베이스에</span> <span class=\"pre\">저장되지</span> <span class=\"pre\">않습니다.).</span> <span class=\"pre\">:setting:`MEDIA_URL</span></code> 기본 공개 URL 디렉토리로 정의하세요. 또한 웹서버의 사용자 계정으로 이 디렉토리에 쓰기가 가능하도록 해야 합니다.</p></li>\n<li><p>Add the <a class=\"reference internal\" href=\"/ko/3.2/ref/models/fields/#django.db.models.FileField\" title=\"django.db.models.FileField\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">FileField</span></code></a> or\n<a class=\"reference internal\" href=\"/ko/3.2/ref/models/fields/#django.db.models.ImageField\" title=\"django.db.models.ImageField\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">ImageField</span></code></a> to your model, defining the\n<a class=\"reference internal\" href=\"/ko/3.2/ref/models/fields/#django.db.models.FileField.upload_to\" title=\"django.db.models.FileField.upload_to\"><code class=\"xref py py-attr docutils literal notranslate\"><span class=\"pre\">upload_to</span></code></a> option to specify a\nsubdirectory of <a class=\"reference internal\" href=\"/ko/3.2/ref/settings/#std-setting-MEDIA_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">MEDIA_ROOT</span></code></a> to use for uploaded files.</p></li>\n<li><p>당신의 데이터베이스에 저장되는것은 해당 파일에 대한 경로 정보입니다.(  <code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">MEDIA_ROOT`에</span> <span class=\"pre\">관한</span> <span class=\"pre\">).</span> <span class=\"pre\">당신은</span> <span class=\"pre\">장고가</span> <span class=\"pre\">제공하는</span> <span class=\"pre\">:attr:`~django.db.models.fields.files.FieldFile.url</span></code> 속성을 자주 쓰게 될 것입니다. 예를 들면 만약 당신의 :class:<a href=\"#id1\"><span class=\"problematic\" id=\"id2\">`</span></a>~django.db.models.ImageField`가 <a href=\"#id3\"><span class=\"problematic\" id=\"id4\">``</span></a>mug_shot``이면, 템플릿에서 이미지에 대한 절대 경로를 <a href=\"#id5\"><span class=\"problematic\" id=\"id6\">``</span></a>{{ object.mug_shot.url }}``로 얻을 수 있습니다.</p></li>\n</ol>\n</section>\n<section id=\"how-do-i-make-a-variable-available-to-all-my-templates\">\n<h2>어떻게 템플릿에 변수를 사용할 수 있도록 만드나요?<a class=\"heading-anchor\" href=\"#how-do-i-make-a-variable-available-to-all-my-templates\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Sometimes your templates all need the same thing. A common example would be\ndynamically generated menus. At first glance, it seems logical to add a common\ndictionary to the template context.</p>\n<p>The best way to do this in Django is to use a <code class=\"docutils literal notranslate\"><span class=\"pre\">RequestContext</span></code>. Details on\nhow to do this are here: <a class=\"reference internal\" href=\"/ko/3.2/ref/templates/api/#subclassing-context-requestcontext\"><span class=\"std std-ref\">Using RequestContext</span></a>.</p>\n</section>","rootId":"faq-using-django","toc":[{"title":"왜 DJANGO_SETTINGS_MODULE를 import하는데 에러가 발생하나요?","anchor":"why-do-i-get-an-error-about-importing-django-settings-module","children":[]},{"title":"당신의 템플릿 언어를 못견디겠습니다. 이걸 써야 하나요?","anchor":"i-can-t-stand-your-template-language-do-i-have-to-use-it","children":[]},{"title":"모델/데이터베이스 계층을 사용해야 하나요?","anchor":"do-i-have-to-use-your-model-database-layer","children":[]},{"title":"어떻게 이미지나 파일 필드를 사용할 수 있나요?","anchor":"how-do-i-use-image-and-file-fields","children":[]},{"title":"어떻게 템플릿에 변수를 사용할 수 있도록 만드나요?","anchor":"how-do-i-make-a-variable-available-to-all-my-templates","children":[]}],"breadcrumbs":[{"docname":"faq/index","title":"장고 자주묻는 질문","url":"/ko/3.2/faq/"}],"prev":{"docname":"faq/install","title":"자주묻는 질문: 설치","url":"/ko/3.2/faq/install/"},"next":{"docname":"faq/help","title":"자주 묻는 질문: 도움을 받는법","url":"/ko/3.2/faq/help/"},"formats":{"html":"/ko/3.2/faq/usage/","markdown":"/ko/3.2/faq/usage.md","json":"/ko/3.2/faq/usage.json"},"source":"https://github.com/django/django/blob/stable/3.2.x/docs/faq/usage.txt","official":"https://docs.djangoproject.com/ko/3.2/faq/usage/","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"]}