How To Install
ココか ら最新版のDjangoを取得します。
解凍してインストールを実行します。
tar xzvf Django-1.3.tar
cd Django-1.3
sudo python setup.py install
インストールできたか確認してみましょう。Versionが表 示されたらOK!
# django-admin.py --version
1.3
参考サイト:
How to Install Django on an Ubuntu Linux Server
How to Create Django Project
プロジェクト作成
django-admin.py startproject mysite
アプリケーションの作成
manage.py startapp newapp
DB作成
linux:~/captcha/cap$ createdb -O postgres -U kumagon capt
linux:~/captcha/cap$
linux:~/captcha/cap$ psql capt
psql (8.4.3)
"help" でヘルプを表示します.
capt=# \l
データベース一覧
名前 | 所有者 | エンコーディング | 照合順序 | Ctype(変換演算子) | アクセス権
-----------+----------+------------------+-------------+-------------------+-----------------------
capt | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 |
settings.py の設定(postgresqlを利用する場合)
DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'capt' # Or path to database file if using sqlite3.
DATABASE_USER = 'hoge' # Not used with sqlite3.
DATABASE_PASSWORD = '1234' # Not used with sqlite3.
DATABASE_HOST = 'localhost' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
syncdb
linux:~/captcha/cap$ python manage.py syncdb
linux:~/captcha/cap$ python manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
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 'hoge'):
E-mail address: hoge@gmail.com
Password:
Password (again):
Superuser created successfully.
Installing index for auth.Permission model
Installing index for auth.Message model