Çöó½ºÅ© - °³½Ã

½¬¿î Genshi ÅÛÇø´À»À§ÇÑ Çöó½ºÅ© È®Àå
Áö±Ý ´Ù¿î·Îµå

Çöó½ºÅ© - °³½Ã ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • BSD License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Dag Odenhall

Çöó½ºÅ© - °³½Ã ű×


Çöó½ºÅ© - °³½Ã ¼³¸í

½¬¿î Genshi ÅÛÇø´À»À§ÇÑ Çöó½ºÅ© È®Àå Flask-Genshi´Â ÅÛÇø´À» À§ÇØ Genshi¸¦ ½±°Ô »ç¿ëÇÒ ¼öÀÖ´Â Çöó½ºÅ© È®ÀåÀÔ´Ï´Ù. ÆÄÀÏ È®Àå¸íÀ» ±â¹ÝÀ¸·Î ÅÛÇø´À» ·»´õ¸µÇÏ°í Mimetype ¼¼Æ®°¡ÀÖ´Â ÀÀ´ä °³Ã¼¸¦ ¸¸µé ¼öÀÖ´Â ¹æ¹ýÀº easy_install ¶Ç´Â PIP·Î Pypi¿¡¼­ °¡Á® ¿À´Â ÀÀ´ä °³Ã¼¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù. ¿¹ : Easy_install Flask-Genshiif´Â »õ·Î¿î ÇÁ·ÎÁ§Æ®¸¦ ½ÃÀÛÇÏÁö ¾Ê½À´Ï´Ù. Flask-Genshi°¡ ÀÌ¹Ì ÀÇÁ¸ÇϹǷΠÇöó½ºÅ©¸¦ ¸í½Ã ÀûÀ¸·Î ¼³Ä¡ÇؾßÇÕ´Ï´Ù. Flaskext.genshi genshiapp = flask (__ name __) genshi = genshi (¾Û) ÅÛÇø´À» ·»´õ¸µÇÏ´Â °¡Àå ÁÁÀº ¹æ¹ýÀ» Á¦°øÇÕ´Ï´Ù. render_response ()¸¦ »ç¿ëÇÏ´Â °ÍÀÔ´Ï´Ù. ÀÌ·¸°ÔÇϸé XHTML, XML ¶Ç´Â ÅؽºÆ®¸¦ ·»´õ¸µ ÇÑ °æ¿ì ÀûÀýÇÑ MIMETYPEÀÌ Àü¼ÛµÇµµ·ÏÇÕ´Ï´Ù. FLASKEXT.GENSHI °¡Á® ¿À±â reden_response@app.route ( '/') DEF À妽º ()¿¡¼­ ´ÙÀ½°ú °°ÀÌÇϽʽÿÀ. Title = 'Genshi + Flask, õ±¹¿¡¼­ ÀÏÄ¡ÇÏ´Â ÀÏÄ¡!' reprent_response ( 'index.html', dict (title = title)) methodsMethods¸¦ »ç¿ëÇÏ¿© doctype ¹× ender_response ()À» »ç¿ëÇÏ¿© ·»´õ ŸÀÔ°ú °°Àº renderype ¹× ·»´õ À¯Çü°ú °°Àº Á¦¾î¸¦ Á¦¾îÇÕ´Ï´Ù. °ãÃÄ ¾²ÀÌ´Â °æ¿ì°¡ ¾Æ´Ï¸é ÅÛÇø´ÀÇ ÆÄÀÏ À̸§ È®ÀåÀÚ°¡ °áÁ¤ÇÑ ¸Þ¼Òµå°¡ °áÁ¤µË´Ï´Ù. ±âº» HTMLÀº ¾ö°ÝÇÑ HTML 4.01·Î ·»´õ¸µµË´Ï´Ù. ÀÌ°ÍÀº HTML5·Î º¯°æÇÏ´Â ¹æ¹ýÀÔ´Ï´Ù. genshi.extensions = 'html5'i´Â ÀÌ°Í¿¡ ´ëÇØ ÃßõÇÏÁö¸¸ ¹°·Ð XHTML·Î º¯°æÇÒ ¼öµµ ÀÖ½À´Ï´Ù. genshi.extensions ='xhtml'you can ¶ÇÇÑ ÅÛÇø´ ÇÔ¼ö¿¡ ´ëÇÑ ¸Å°³ º¯¼ö·Î ±âº»°ªÀ» ¹«½ÃÇÕ´Ï´Ù. render_response ( 'video.html', method = 'html5') È®Àå HTML, XML, TXT, JS ¹× CSS´Â ÀνĵÇÁö¸¸ ¿øÇÏ´Â È®Àå ¹× ¸Þ¼­µå¸¦ Ãß°¡ ÇÒ ¼ö ÀÖ½À´Ï´Ù. ...¿¡ txt, js ¹× css ÅÛÇø´Àº genshi.template.newTextTemplate·Î ·»´õ¸µµÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù. ÅÛÇø´À» »ç¿ëÇÏ¿© JavaScript ·»´õ¸µÀº Flask.url_for ()¿Í ÅÛÇø´ÀÌÀÖ´Â CSS¸¦ »ç¿ëÇÏ¿© variables.api ReferenceClass Flaskext.genshi.genshi (App) È®ÀåÀ» »ç¿ëÇÏ¿© ¾î¶² ¸Þ¼Òµå¸¦ »ç¿ëÇÏ´Â ¹æ¹ýÀ» Á¦°øÇÕ´Ï´Ù. ¸Þ¼Òµå ·»´õ¸µ ¹æ¹ý. template_loader flask.flaskext.genshi.flaskext.genshi.select_method (ÅÛÇø´, ¸Þ¼­µå = ¾øÀ½)¿Í µ¿ÀÏÇÑ À§Ä¡¿¡¼­ ÅÛÇø´À»·ÎµåÇÏ´Â genshi.template.templateLoader´Â ÅÛÇø´ ¹× genshi.extensionsÀÇ ÆÄÀÏ È®ÀåÀÚ¸¦ ±â¹ÝÀ¸·Î Genshi.methods¿¡¼­ ¸Þ¼Òµå¸¦ ¼±ÅÃÇÕ´Ï´Ù. method.flaskext.genshi.generate_template (ÅÛÇø´, context = none, method = ¾øÀ½) flaskext.genshi.render_template (ÅÛÇø´, ÄÁÅؽºÆ® = ¾øÀ½, ¸Þ¼­µå = ¾øÀ½) ·»´õ¸µ ÇÒ ¼öÀÖ´Â ÇÊÅÍ ¹× º¯È¯À» ½ÇÇàÇÒ ¼öÀÖ´Â Genshi ÅÛÇø´ ½ºÆ®¸²À» ¸¸µì´Ï´Ù. String.flaskext.genshi.Render_Response (ÅÛÇø´, ÄÁÅؽºÆ® = ¾øÀ½, ¸Þ¼­µå = ¾øÀ½) ÅÛÇø®Æ® ÅÛÇø´À» ·»´õ¸µÇÏ°í ·»´õ¸µ ¸Þ¼Òµå¿¡ µû¶ó MimeType ¼¼Æ®¸¦ »ç¿ëÇÏ¿© response_class¿¡¼­ ·¦ÇÎÇÕ´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽㠡¤ Çöó½ºÅ©


Çöó½ºÅ© - °³½Ã °ü·Ã ¼ÒÇÁÆ®¿þ¾î