django:startproject

#apt-get install python-django

 

#
# echo "create database cats" | mysql
#  echo "grant all privileges on cats.* to ‘cats’@’localhost’ identified by ‘cats’" | mysql
#  mysql -u cats cats -p
#

hide@deb1:~/dj$ django-admin startproject cats
hide@deb1:~/dj$ cd cats
hide@deb1:~/dj/cats$ vi settings.py

DATABASE_ENGINE = ‘mysql’
DATABASE_NAME = ‘cats’
DATABASE_USER = ‘cats’
DATABASE_PASSWORD = ‘cats’
DATABASE_HOST = ‘localhost’
DATABASE_PORT = ‘3306’

TIME_ZONE = ‘Asia/Tokyo’

LANGUAGE_CODE = ‘ja’

hide@deb1:~/dj/cats$ python manage.py runserver
Validating models…
Skipping validation because things aren’t configured properly.
Django version 0.95.1, using settings ‘cats.settings’
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/django/core/servers/basehttp.py", line 272, in run
    self.result = application(self.environ, self.start_response)
  File "/var/lib/python-support/python2.4/django/core/servers/basehttp.py", line 615, in __call__
    return self.application(environ, start_response)
  File "/var/lib/python-support/python2.4/django/core/handlers/wsgi.py", line 143, in __call__
    self.load_middleware()
  File "/var/lib/python-support/python2.4/django/core/handlers/base.py", line 29, in load_middleware
    mod = __import__(mw_module, ”, ”, [”])
  File "/var/lib/python-support/python2.4/django/contrib/sessions/middleware.py", line 2, in ?
    from django.contrib.sessions.models import Session
  File "/var/lib/python-support/python2.4/django/contrib/sessions/models.py", line 3, in ?
    from django.db import models
  File "/var/lib/python-support/python2.4/django/db/__init__.py", line 11, in ?
    backend = __import__(‘django.db.backends.%s.base’ % settings.DATABASE_ENGINE, ”, ”, [”])
  File "/var/lib/python-support/python2.4/django/db/backends/mysql/base.py", line 12, in ?
    raise ImproperlyConfigured, "Error loading MySQLdb module: %s" % e
ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
[05/Apr/2008 07:13:45] "GET / HTTP/1.0" 500 1310

 

deb1:~# apt-cache search python | grep mysql
libghc6-hsql-mysql-dev – Multi-Database Interface System for Haskell
python-mysqldb – A Python interface to MySQL

 

deb1:~# dpkg -l | grep mysqldb | wc
      0       0       0

deb1:~# apt-get install python-mysqldb
Reading package lists… Done
Building dependency tree… Done
Suggested packages:
  python-egenix-mxdatetime
The following NEW packages will be installed:
  python-mysqldb
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 80.0kB of archives.
After unpacking 225kB of additional disk space will be used.
Get:1 http://cdn.debian.or.jp etch/main python-mysqldb 1.2.1-p2-4 [80.0kB]
Fetched 80.0kB in 0s (436kB/s)
Selecting previously deselected package python-mysqldb.
(Reading database … 40128 files and directories currently installed.)
Unpacking python-mysqldb (from …/python-mysqldb_1.2.1-p2-4_i386.deb) …
Setting up python-mysqldb (1.2.1-p2-4) …
INFO: using unsupported version ‘/usr/bin/python2.5’

 

 

hide@deb1:~/dj/cats$ python manage.py runserver
Validating models…
0 errors found.

Django version 0.95.1, using settings ‘cats.settings’
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

 

#lynx http://localhost:8000

404 redirected to this:

image

カテゴリー: 未分類 パーマリンク

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中