´åÄÄPython ¿ë °í±Þ ±¸¼º Æļ | |
Áö±Ý ´Ù¿î·Îµå |
´åÄÄ ¼øÀ§ ¹× ¿ä¾à
±¤°í
- ƯÇã:
- MIT/X Consortium Lic...
- °¡°Ý:
- FREE
- °Ô½ÃÀÚ À̸§:
- Antoine Millet
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://inaps.org
´åÄÄ Å±×
´åÄÄ ¼³¸í
DOTCONF´Â Áßø ¼½¼ÇÀ» ·¹º§, ±¸¹®À¸·Î ÀÔ·Â ÇÑ ÀÔ·Â ÇÑ °ª, ÆÄÀÏ Æ÷ÇÔ µîÀ» Çã¿ëÇÏ´Â °í±Þ ±¸¼º ÆļÀÔ´Ï´Ù. ¶ÇÇÑ °·ÂÇÑ ½ºÅ°¸¶ À¯È¿¼º °Ë»ç ½Ã½ºÅÛ°ú ÇÔ²² Á¦°øµË´Ï´Ù .ExampleThis´Â Imaginary À¥ ¼¹öÀÇ ±¸¼º ÆÄÀÏÀÇ ¿¹ÀÔ´Ï´Ù. µ¥¸ó = truePidFile = '/var/run/myapp.pid'interface ='0.0.0:80'Interface_ssl = ' 0.0.0.0:443'Host 'example.org'{path '/'{rate_limit = 30}} È£½ºÆ® 'protected.example.org'{enable_ssl = yes path '/ files'{enable_auth = yes user 'foo'{password = 'bar'}}} dotconf import dotconf >>> parsed_file ( 'mywebserver.conf') >>> parsed_conf.get ( ')À» ÀμâÇÕ´Ï´Ù. DAEMON ', FALSE) TRUEEEVER°¡ ´õ Èï¹Ì·Ó°Ô ÁøÄ¡¸¦ ÇÇÇϱâ À§ÇØ À¯È¿¼º °Ë»ç ½ºÅ°¸¶¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù. ¼öµ¿ ±¸¼º ÆÄÀÏ À¯È¿¼º °Ë»çÀÇ °íÅ뽺·¯¿î ÀÛ¼º : DOTCONF.SCHEMA °¡Á® ¿À±â ¸¹Àº, onefrom °¡Á® ¿À±â ¼½¼Ç, valuefrom dotconf.schema.types °¡Á® ¿À±â ºÎ¿ï, Á¤¼ö, float, ¹®ÀÚ¿ # ½ºÅ°¸¶ Á¤ÀÇ : Ŭ·¡½º »ç¿ëÀÚ Á¤ÀÇ (¼½¼Ç) : password = value (string ()) _Meta = { '¹Ýº¹': ¸¹Àº, '°íÀ¯ ÇÑ': true} Ŭ·¡½º PathSec tion (¼½¼Ç) : rate_limit = °ª (float (), default = 0) enable_auth = value (boolean (), default = false) user = usersection () Ŭ·¡½º VirtualHostsection (¼½¼Ç) : base_path = value (string () enable_ssl = value (boolean (), default = false) path = pathsection () _meta = { 'Repeat': many, '°íÀ¯ ÇÑ': true} class myWebServerConfiguration (¼½¼Ç) : daemon = value (boolean () default = false) pidfile = °ª (string (), default = none) ÀÎÅÍÆäÀ̽º = °ª (string (), default = '127.0.0.1 : 80') interface_ssl = value (string), default = '127.0.0.1 : 443') È£½ºÆ® = VirtualHostsection () ±×·± ´ÙÀ½ API¸¦ À¯È¿ÇÏÁö ¾ÊÀº °Íó·³ API¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. >>>¿¡¼ dotconf °¡Á® ¿À±â dotconf >>> myConfschema °¡Á® ¿À±â mywebserverconfiguration >>> parsed_conf = dotconf (conf, schema = mywebserverconfiguration) >>> Àμâ 'µ¥¸ó :', parsed_conf.get ( 'daemon') daemon : true >>> parsed_conf.subsections ( 'host')¿¡¼ VHOSTÀÇ °æ¿ì : >>> Àμâ vhost.args >>> "vhost.get ( 'enable_ssl') :> >> vhost.subsections ( 'path')ÀÇ °æ·Î¿¡ ´ëÇØ 'SSL »ç¿ë'>>> Àμâ >>> Àμâ "+ °æ·Î .Args >>> Path.get ( 'enable_auth') : >>> Àμâ '´ÙÀ½ÀºÀÌ µð·ºÅ丮¿¡ ¾×¼¼½º ÇÒ ¼ö ÀÖ½À´Ï´Ù. Path.subsections ('user ')ÀÇ »ç¿ëÀÚÀÇ °æ¿ì : >>> Àμâ '-'+ User.Args >>> example.org /protected.example.org SSL »ç¿ë / ÆÄÀÏ »ç¿ëÀÚ ´ÙÀ½ÀÌ µð·ºÅ丮¿¡ ¾×¼¼½º ÇÒ ¼ö ÀÖ½À´Ï´Ù. - FooproductÀÇ È¨ÆäÀÌÁö
´åÄÄ °ü·Ã ¼ÒÇÁÆ®¿þ¾î