Django-staticfiles.

Á¤Àû ÆÄÀÏÀ» Á¦°øÇÏ´Â ÇïÆÛ¸¦ Á¦°øÇÏ´Â Django ¾Û
Áö±Ý ´Ù¿î·Îµå

Django-staticfiles. ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • BSD License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Jannis Leidel
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://github.com/jezdez/

Django-staticfiles. ű×


Django-staticfiles. ¼³¸í

Á¤Àû ÆÄÀÏÀ» Á¦°øÇϱâÀ§ÇÑ ÇïÆÛ¸¦ Á¦°øÇÏ´Â Django ¾Û Django-staticfiles´Â Django-static ÆÄÀÏ¿¡ ´ëÇÑ ÁÖ¿ä À¥ »çÀÌÆ®°¡ Bitbucket.org/jezdez/django-static ÆÄÀÏÀ» Á¦°øÇÏ´Â Django-static ÆÄÀÏÀ» Á¦°øÇÏ´Â Django ÀÀ¿ë ÇÁ·Î±×·¥ÀÔ´Ï´Ù. DjangoÀÇ °³¹ß ¹öÀüÀ» ¼³Ä¡ÇÒ ¼öµµ ÀÖ½À´Ï´Ù. PIP°¡ÀÖ´Â staticfiles django-static ÆÄÀÏ == dev ¶Ç´Â easy_install django-staticfiles == dev.management commandsbuild_staticÀº ¸ðµç ¼³Ä¡µÈ ÀÀ¿ë ÇÁ·Î±×·¥¿¡¼­ ¹Ìµð¾î ÆÄÀÏÀ» º¹»çÇÏ°í staticfiles_storage¸¦ º¹»çÇÕ´Ï´Ù. ¾Û À̸§ ¸ñ·ÏÀ» Á¦°øÇÏ¿© ±¸¹® ºÐ¼® ÇÑ ¾ÛÀ» Á¦ÇÑ ÇÒ ¼ö ÀÖ½À´Ï´Ù. python manage.py build_static --exclude-dirs admin pollsduplicate ÆÄÀÏ À̸§Àº ÅÛÇø´ Çػ󵵰¡ ÀÛµ¿ÇÏ´Â ¹æ½Ä°ú ºñ½ÁÇÑ ¹æ½ÄÀ¸·Î ÇØ°áµË´Ï´Ù. ÆÄÀÏÀº STATIMFILES_DIRS À§Ä¡¿¡¼­ óÀ½ °Ë»ö ÇÑ ´ÙÀ½ installated_apps ¼³Á¤À¸·Î ÁöÁ¤µÈ ¼ø¼­´ë·Î ¾ÛÀ» °Ë»öÇÕ´Ï´Ù. ÀϹÝÀûÀ¸·Î »ç¿ëµÇ´Â ¿É¼ÇÀº ´ÙÀ½°ú °°½À´Ï´Ù. - NoInput ¸ðµç Á¾·ùÀÇ ÀÔ·ÂÀ» À§ÇØ »ç¿ëÀÚ¿¡°Ô ¸Þ½ÃÁö¸¦ Ç¥½ÃÇÏÁö ¾Ê½À´Ï´Ù.-i Pattern ¶Ç´Â -ignore = ÆÐÅÏ ÀÌ Glob ½ºÅ¸ÀÏ ÆÐÅÏ°ú ÀÏÄ¡ÇÏ´Â ÆÄÀÏÀ̳ª µð·ºÅ丮¸¦ ¹«½ÃÇϽʽÿÀ. ´õ ¸¹Àº °ÍÀ» ¹«½ÃÇϱâ À§ÇØ ¿©·¯ ¹ø »ç¿ëÇϽʽÿÀ.-n ¶Ç´Â --dry-run ÆÄÀÏ ½Ã½ºÅÛÀ» ¼öÁ¤ÇÏ´Â °ÍÀ» Á¦¿ÜÇÏ°í´Â ¸ðµÎ ¼öÇàÇϽʽÿÀ. -l ¶Ç´Â -link º¹»ç ´ë½Å °¢ ÆÄÀÏ¿¡ ±âÈ£ ¸µÅ©¸¦ ¸¸µì´Ï´Ù. - Exclude-Dirs´Â staticfiles_dirs ¼³Á¤. Àüü ¿É¼Ç ¸ñ·ÏÀº fiston manage.py build_static -helpresolve_staticResolves ÆÄÀÏ ½Ã½ºÅÛÀÇ °¢ ¹Ìµð¾î ÆÄÀÏÀÇ Àý´ë °æ·Î¿¡ ´ëÇÑ Çϳª ÀÌ»óÀÇ ¿¹»ó »ó´ë URL °æ·Î¸¦ ½ÇÇàÇÏ¿© build_static °ü¸® ¸í·É µµ¿ò¸»À» ÂüÁ¶ÇϽʽÿÀ. ¿¹ : Python Manage.py Resolve_Static CSS / Base.css °ü¸® / js / core.css / home / special.polls.com/ core / media / css / base.css / home / polls.com / ÇÙ½É / ¹Ìµð¾î / CSS /base.css/home/polls.com/src/django/contrib/admin/media/js/core.jsby ±âº»°ªÀ̸ç ÀÏÄ¡ÇÏ´Â ¸ðµç À§Ä¡°¡ ¹ß°ßµË´Ï´Ù. °¢ »ó´ë °æ·Î¸¶´Ù ù ¹ø° ÀÏÄ¡ ¸¸ ¹ÝȯÇÏ·Á¸é --first ¿É¼ÇÀ» »ç¿ëÇϽʽÿÀ. python manage.py resolve_static css / base.css --first / home / special.polls.com / core / media / css / base.cssstatic_url ÄÁÅؽºÆ® Processorto ÅÛÇø´¿¡¼­ Á¤Àû ÆÄÀÏ ÀÚ»êÀ» ÂüÁ¶ÇÏ¿© Á¤Àû ÆÄÀÏÀÌ Á¦°øµÇ´Â URL °æ·Î·Î static_url ¼³Á¤À» ¼³Á¤Çß´ÂÁö È®ÀÎÇϽʽÿÀ. static_url ÄÁÅؽºÆ® ÇÁ·Î¼¼¼­¸¦ template_context_processors ¼³Á¤¿¡ Ãß°¡ÇϽʽÿÀ. template_context_processors = ( 'staticfiles.context_processors.static_url' ÀÌÁ¦ requestContext·Î ·»´õ¸µ µÈ ÅÛÇø´Àº ÀÌÁ¦ static_url ÄÁÅؽºÆ® º¯¼ö¿¡ ¾×¼¼½º ÇÒ ¼ö ÀÖ½À´Ï´Ù. DevelopmentNotEdon¿¡¼­ Á¤Àû ÆÄÀÏÀ» Á¦°øÇÏÁö ¾Ê´Â ÇÁ·Î´ö¼Ç ¼­¹ö¿¡¼­ »ç¿ëÇÏÁö ¸¶½Ê½Ã¿À. ÀÌ ±â´ÉÀº °³¹ßÀ»À§ÇÑ °ÍÀÔ´Ï´Ù. Á¦¹ß, ¹ßÀ» ½îÁö ¸¶½Ê½Ã¿À. Media_URL ¹× static_url ¸ðµÎ¿¡ ´ëÇØ Á¤Àû ¹Ìµð¾î¸¦ Á¦°øÇϵµ·Ï ±âº» URL ±¸¼ºÀÇ ³¡¿¡ ´ÙÀ½ ½º ´ÏÆêÀ» Ãß°¡ÇϽʽÿÀ. Django.conf °¡Á® ¿À±â ¼³Á¤ Imsetion.Debug : UrlPatterns + = ÆÐÅÏ ( '', (r ' staticfiles.urls ') ±âº» Á¤Àû ÆÄÀÏ ÀúÀå¼Ò (Áï, ´Ù¸¥ staticfiles_storage¸¦ »ç¿ëÇÏ´Â °æ¿ì,À̸¦ ¼³Á¤ÇÒ ÇÊ¿ä°¡ ¾ø½À´Ï´Ù.) .static_urldefault : static_root¿¡¼­ Á¦°øµÇ´Â ÆÄÀÏÀ» ó¸®ÇÏ´Â '(ºó ¹®ÀÚ¿­) URL, ¿¹ : static_url ='/ site_media / static / '(static /') Ç×»ó trailing slash.staticfiles_dirsdefault : []ÀÌ ¼³Á¤Àº ¹Ìµð¾î ÆÄÀÏÀ» ãÀ» ¶§ staticfiles ¾ÛÀÌ ÀÌ¼Û µÉ Ãß°¡ À§Ä¡¸¦ Á¤ÀÇÇÕ´Ï´Ù. build_static ¶Ç´Â resolve_static °ü¸® ¸í·ÉÀ» »ç¿ëÇϰųª Á¤Àû ÆÄÀÏ ¼­ºù ºä¸¦ »ç¿ëÇÏ´Â °æ¿ì (Á¢µÎ¾î, °æ·Î) Æ©ÇÃÀÇ ½ÃÄö½º (staticfiles_dirs = (( '', ''sprecial.polls.com) ½ÃÄö½º·Î Á¤ÀÇÇؾßÇÕ´Ï´Ù. / polls / media '), (' ','/home/polls.com/polls/media '), ('°øÅëÀû ÀÎ ','/ opt / webfiles / common '),) staticfiles_prenep_label_appsdefault : ('django.contrib.admin ',) ·¹À̺í À̸§°ú ÇÔ²² Á¢µÎ»ç°¡µÇ¾î¾ßÇÏ´Â ¾Û °æ·ÎÀÇ ¼ø¼­ÀÔ´Ï´Ù. ¿¹¸¦ µé¾î, Django.Contrib.Admin ¹Ìµð¾î ÆÄÀÏÀº Á¤Àû root.staticfiles_media_dirnamesdefault : ( '¹Ìµð¾î',) ½ÃÄö½ºÀÇ ½ÃÄö½ºÀÇ ¹Ìµð¾î ÆÄÀÏÀÌ ¾Æ´Ñ admin / ¿¡¼­ admin / ¸¦ Á¦°øÇؾßÇÕ´Ï´Ù. ¼³Ä¡µÈ ¾Û¿¡¼­ ¹Ìµð¾î ÆÄÀÏÀ» °Ë»ö ÇÒ ¶§ »ç¿ëÇϽʽÿÀ. ¾Û¿¡ ¹Ìµð¾î ÆÄÀÏÀÌ / Á¤ÀûÀ¸·Î »ç¿ëµÇ´Â °æ¿ì : staticfiles_media_dirnames = ( '¹Ìµð¾î', 'static', 'media'scluded_appsdefault : ¡¤ DjangoÀÇ "¹Ìµð¾î"(¾÷·Îµå ¿ë) ¹× "Á¤Àû"ÆÄÀÏÀÇ ¿ë¾î »ç¿ë »çÀÌÀÇ È¥µ¿À» ÇÇÇϱâ À§ÇØ Build_media ¹× Resolve_Media °ü¸® ¸í·ÉÀ» build_static ¹× resolve_media·Î º¯°æÇϽʽÿÀ. ¡¤ ´ëºÎºÐÀÇ ³»ºÎ ·ÎÁ÷ÀÇ ´ëºÎºÐÀ» Àç ÀÛ¾÷ÇÏ¿© °ü¸® ¸í·É¿¡¼­ ¸Ö¸® ¶³¾îÁø ÇÙ½É ±â´ÉÀ» Ãß»óÈ­ÇÕ´Ï´Ù. ¡¤ ÆÄÀÏ ½Ã½ºÅÛ ÀúÀå¼Ò ¹é¿£µå¸¦ ±âº»ÀûÀ¸·Î »ç¿ëÇÏ¿© »ç¿ëÀÚ Á¤ÀÇ ÀúÀå¼Ò ¹é¿£µå·ÎÀ̸¦ ¹«½ÃÇÒ ¼öÀÖ´Â ±â´ÉÀ» »ç¿ëÇÕ´Ï´Ù. ¡¤ Á¤Àû ÆÄÀÏ ÇØ°áÀ» °£¼ÒÈ­ÇÏ´Â »èÁ¦ - ÀÎÅÏ ¾×Ƽºê ¿É¼Ç. ¡¤ ±¤¹üÀ§ÇÑ Å×½ºÆ®°¡ Ãß°¡µÇ¾ú½À´Ï´Ù ¡¤ Ç¥ÁØ ·Î±ëÀ» »ç¿ëÇÕ´Ï´Ù


Django-staticfiles. °ü·Ã ¼ÒÇÁÆ®¿þ¾î