Programming
基本的にはDjango with Apache and mod wsgiに沿ってmac portでインストールした後にhttpd.confに以下の行を追加すればOK。 LoadModule wsgi_module modules/mod_wsgi.so だが、その後 apachectl start としてApacheを起動しようとすると以下のエラーが出た…
Django documentaion: Sending e-mailにあるように from django.core.mail import send_mailsend_mail('Subject here', 'Here is the message.', 'from@example.com', ['to@example.com'], fail_silently=False) という感じでgmailからメールを送ろうと四苦…
Pythonのinteractive consoleで import this と打つとZen of Pythonがでてくる。 The Zen of Python, by Tim PetersBeautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated.…
settings.pyでtemplatesディレクトリをダイナミックに指定する方法 The Django Book Chapter 4: Templatesより拝借。 import os.pathTEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'), ) ".replace('\\','/')"が…
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" 今使ってるPython2.7系のパッケージは↓の下にあるっぽい。 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages djangoディレクトリもこ…
Writing your first Django app, part 1に沿ってはじめてDjangoでwebアプリを作ってみた。色々躓いたのでメモしておこう。 Python, Django, MySQL, MySQLdbのmacへのインストールの大まかな流れはStackoverflowの記事:Django + MySQL on Mac OS 10.6.2 Snow…
先日Pythonをmacで初めてまもなく躓いたKey-bindingの設定についてメモしておこう。 エキスパートPythonプログラミングの1章にも似たようなことが書いてあるのだが、タブ補完の設定がどーにもうまくいかなかった。 しばしの格闘後なんとか解決。 Python Stan…