Python

Pythonはもっと触りたいのですが、

オライリー本Natural Language Processing with Python (by Steven Bird, Ewan Klein, Edward Loper)

を読んだあと、長いことほったらかしに。
ちなみに上の本は結構話題が豊富でためになりました。

自分で何か新しいものが作れるようになるには、
結構課題がいりそうな感じですが、
統計学のあたりの勉強の復習にもなったので良かったかと。

で、つい最近Djangoも簡単ときいたので早速OSX10.6にインストール。

最初のチュートリアルをとりあえず終えた。

このあたりのプロジェクトの作り方はRoRに近いものを感じましたが、DRYだとこういう風になるのか?と感じながら、相変わらず結構ミスもしつつ。

例えば、
Database setupと言っているのに、
mysite/setting.pyで
ENGINEとNAMEを指定し忘れたせいで、



  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/Library/Python/2.6/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/Library/Python/2.6/site-packages/django/db/backends/dummy/base.py", line 15, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.



なんて出てきたりもして。
さらに、sqlite3指定でsyncdbすると


mysite kitsu$ python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table polls_poll
Creating table polls_choice

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'user'):
E-mail address:


なんて言われるからちょっとビクッとしつつ無難なメアドを指定して…

やっぱり実用だと大規模で使うようなDBの設定をしないといけないのだろうな、
と思いつつ、Tutorialを進めて行きたいです。(Part4まであるようなので)


コメント