http://d.hatena.ne.jp/jbking/20060310/p1 ã§å°ã£ã¦ãããã§ããTemplate_Loaderãèªä½ãã¦ã¿ããã©ãï¼ã£ã¦è©±ã§ãã ã§ãã¤ãã®éãQuickHackã ï¼ã½ã¼ã¹èªãã®é åã§ãï¼ TEMPLATE_LOADERSã®ç°¡åãªä»æ§ Template_Loaderã¯"settings.py"ã«æ¸ãããã ãã© ããã©ã«ãã§ã¯ TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', )ã¨ãªã£ã¦ãã¾ãã 確ãä¸ããé ã«
Welcome to Djangosnippets.org, a site for users of the Django web framework to come together and share useful "snippets" of reusable code. If you're just here to browse, you can look through snippets organized by author, by language or by tag. You can also have a look at the top-rated snippets and the most-bookmarked snippets. If you'd like to contribute, sign up for a free account and you'll be a
ãã¾ã¾ã§ä½æ°ãªã views.py ã®ä¸ã§ä½¿ã£ã¦ãã¾ã£ã render_to_response ã§ãããä½ããã¦ããã®ãããããªãã¾ã¾ä½¿ãã®ã¯è¯ããªãã¨æã£ãã®ã§ãä»åã¯ãã®é¢æ°ã使ããã«åããããªãã¨ããã¦ã¿ããã¨æãã¾ãã ã¾ã㯠views.py ã®ç¾ç¶ã®ã³ã¼ããè¦ã¦ã¿ã¾ãã # vim:fileencoding=utf-8 from django.shortcuts import render_to_response from django.template import RequestContext def first(request): from datetime import datetime return render_to_response('first.html', { 'abc': u'abcã§ãã¨ï¼', 'none_data': None, 'empty_strin
ä»æ¥ã¯ Middleware ã§ãã å½¹å² ããã«ã¦ã§ã¢ã¨è¨ã£ã¦ããApache ã¨ã Tomcat ã¨ããOracleã¨ãã¨ã¯ä½ç½®ã¥ããç°ãªã£ã¦ãã¦ãDjangoã®ããã«ã¦ã§ã¢ã¨ããã¨ãæ¡å¼µãã¤ã³ãã®ãã¨ãæãã¦ãã¾ããã©ã®ä½ç½®ã®æ¡å¼µãã¤ã³ããã¨ããã¨ãviews.pyã«å¦çãå°éãã以åã®æ¡å¼µãã¤ã³ãã§ããJavaServlet APIã§è¨ãã¨ããã® Filterã®å½¹å²ã§ãã å®è£ æ¹æ³ ããã«ã¦ã§ã¢ã¯ Context Processorã¨ã¯éããé¢æ°ã§ã¯ãªãã¯ã©ã¹ã§å®ç¾©ãã¾ããã¾ããã¯ã©ã¹ã®ä¸ã®é¢æ°åã¨å¼æ°ã次ã®ããã«æ±ºãããã¦ãã¾ãã process_request(self, request) ã¯ã©ã¤ã¢ã³ãããã¢ã¯ã»ã¹ããã£ã¦ãURL ãã urls.py ã«å®ç¾©ãããé¢æ°ã¸ã®ãããã³ã°ãè¡ãããåã«å¼ã³åºããã¾ããã¤ã¾ãæåè¡ã®é¢æ°ã åãç¡ãã®ã§ãããã«ããã§ããããã®é¢æ°ã¯å¦
æ¸æ¥è¨@shibu.jp æ¸å·ãããã®æ¥è¨ã§ããã½ããã¦ã§ã¢éçºã¨ããã©ã¤ãããã¯ãä¸å¿ã«è¨äºãæ¸ãã¦ããã¾ãã Djangoã®ããã«ã¦ã§ã¢ãä½ã£ã¦ã¿ã¾ããããããç°¡åã§ããããããã°ã¢ã¼ãã§å®è¡ãã¦ããã¨ãå³ä¸ã«ãã¢ããã°ãã¨è¡¨ç¤ºãã¾ããã¾ããããã§ããããã«ã¦ã§ã¢ã¨ããã®ã¯ãå ¥åºåããããã£ãããããã¨ãã§ããæ¡å¼µæ©è½ã§ããç°¡åãªä¾ã ã¨ãã±ã¼ã¿ã¤åãã«ã³ã³ãã³ããç·¨éãããã¨ããã®ãããã«ã¦ã§ã¢ãä½ããã¨ã§å®ç¾ã§ãã¾ããDjangoã ã¨ãã¯ã©ã¹ãä¸ã¤ä½ããããã¤ãã¡ã½ãããå®ç¾©ãã¦ããã ãã§ç°¡åã«ä½ãã¾ãã ã¾ãã½ã¼ã¹ã³ã¼ãã§ããããããªæãã§ãããããã°ã¢ã¼ããã©ãããè¦ã¦ããããã°ã¢ã¼ãã ã£ããã</body>ã¿ã°ãè¦ã¤ãã¦ããã®åã«ã¿ã°ãæ¿å ¥ãã¾ããææãããã°ã©ã ã§ãããæ¬å½ãªããæåã³ã¼ããè¦ã¦å¤æ´ããã³ã¼ãã¯å¿ è¦ã«ãªãã¨æãã¾ãã # -*- encoding: utf-8
This article quickly walks you through the process of setting up an absolutely minimal mobile- and desktop-friendly web application using the Django framework. This particular framework works very well with mobile thanks to the way its templates are structured and makes for a good choice for new web-based applications. This article assumes that you have python 2.3 or later and SVN already installe
ããã«ã¡ã¯ãchihiroã§ããä»åã¯Pythonã§ã¢ãã¤ã«ãµã¤ããéçºããå ´åã«ä¾¿å©ãªã©ã¤ãã©ãªãWSGIUserAgentMobileãç´¹ä»ãã¾ããããã¯UserAgentãããã£ãªã¢ã端æ«æ å ±ãåå¾ããããã®ã©ã¤ãã©ãªã§ãã Google Code WSGIUserAgentMobile http://code.google.com/p/wsgiuseragentmobile/ ããã¯åºæ¬çã«ã¯PHPã®PEAR::Net_UserAgent_Mobileãããã«å ã辿ãã°Perlã®HTTP-MobileAgentããåãPythonã«ç§»æ¤ãããã®ã§ãããããã¤ãç¬èªã®ã¡ã½ãããããããã£ã追å ãã¦ãã¾ããã¤ã³ã¹ãã¼ã«ãããåºæ¬çãªä½¿ãæ¹ãDjangoã§ä½¿ç¨ããå ´åã®ä¾ããç´¹ä»ãã¾ãã ã¤ã³ã¹ãã¼ã« 諸è¬ã®äºæ ã«ããã¾ã Python Package Indexã«ç»é²ãã¦ããªãã®ã§ãé
pythonã§æºå¸¯ãµã¤ããä½ãããã«ã¯ãuamobileã便å©ãªããã§ãã SOBARCOã§ãuamobileã¯ä½¿ã£ã¦ããã®ã§ãããã¡ãã£ã¨ãã¼ã¸ã§ã³ãå¤ããä»ã§ã¯çµæ§å¤æ´ããã¦ãã¾ããã ããã¦ä»åº¦ã¯ãDjangoã§å©ç¨ã§ãããããã¦ã¿ãã®ã§ãã®æé ã§ãã Djangoã®ç°å¢ä½æã¯ãã³ã³ãããããã ããã ã¾ãuamobileã以ä¸ããåå¾ãã¾ãã http://pypi.python.org/pypi/uamobile/ ä»åã¯ã0.2.5ãå©ç¨ãã¦ãã¾ãã åå¾ãããã¡ã¤ã«ã解åãã¦ã§ãããã£ã¬ã¯ããªã«ããuamobileãã£ã¬ã¯ããªãDjangoããã¸ã§ã¯ãã®ã«ã¼ããã£ã¬ã¯ããªã®ç´ä¸ã«ã³ãã¼ãã¾ãã uamobileã§ã¯IPyã¨ããã®ã使ã£ã¦ãããããªã®ã§åå¾ãã¾ãã http://pypi.python.org/pypi/IPy ä»åã¯ã0.63ãå©ç¨ãã¦ãã¾ãã åå¾ãããã¡ã¤
2011å¹´05æ25æ¥23:14 ã«ãã´ãª Pythonï¼djangoã®ã½ã¼ã¹ãèªãã§ã¿ãï¼å°ãã¥ã¤ï¼ï¼ django-admin.py ã®ä¸èº« #!/usr/bin/env python from django.core import management if __name__ == "__main__": management.execute_from_command_line() ã¯ã¼ã«ï¼ï¼ ã¨ãããã¿ã¯ããã¦ããã¦ï¼ã¾ãã¯manage.py ããé¢ä¿ããã¨ãã ã追ã£ã¦è¦ãï¼ ââ çµè«ï¼å³ãæãã¦ã¿ãï¼ -- blockdiagã使ããã¦ããã ãã¾ããï¼-- ââ from django.core.management import execute_manager import settings if __name__ == "__main__": execute_manager
ãã¼ã«ã¨ãããã³ã¼ã³ã¨æ ç» ã©ã¹ããã¤ã«ãè¦ããè¯ãæ ç»ã ã£ãã æ ç»é¤¨ã§ã¹ãã¹ãæ³£ãã¦ãé¼»ãåããªããè»ã§å¸°ã£ããææ³ã¯ãã®ããã°ã§ã¯æ¸ããªããã¿ããªæ ç»é¤¨ã«è¡ã£ã¦æãã¦ã¿ã¦ã»ããã 帰ã£ã¦ãããã¤ãã¿ã¼ã§ææ³ãæ¼ããããããããããããããããã ãããã¨ã¾ãæ ç»ãæãåºãã¦â¦
vimã§Pythonã®éçºç°å¢ãä½ã£ã¦ã¿ã¾ããã èªåã¤ã³ãã³ã ã³ã¼ãè£å® ã¹ã¯ãªããã®å®è¡ ã¤ã³ãã³ãã®è¨å® èªå ã¤ã³ãã³ãã¯Pythonã§ã³ã¼ãã£ã³ã°ãããå ´åã«ã¯å¿ é ãªæ©è½ã§ããå®çªã®è¨å®ãããã®ã§ã.vimrcã«è¿½è¨ãã¾ãã filetype plugin on autocmd FileType python setl autoindent autocmd FileType python setl smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class autocmd FileType python setl expandtab tabstop=4 shiftwidth=4 softtabstop=4ã¤ã³ãã³ãã¯4æåã§ã¿ãæåã§ã¯ãªãåè§ã¹ãã¼ã¹ã§è¨å®ããããã«ãã¦ãã¾ããã¾ããifçã®
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}