Info

Djangoアプリケーション設定メモ。

1. python バージョン確認
$ python -V
Python 2.5.1

2. djangoインストール
http://www.djangoproject.com/download/
Django-1.1.1.tar.gz ダウンロード

# tar xzvf Django-1.1.1.tar.gz
# cd Django-1.1.1
# sudo python setup.py install
パスワード:
running install
error: invalid Python installation: unable to open /usr/lib/python2.5/config/Makefile (No such file or directory)

3. python-develインストール
# yum install python-devel
# sudo python setup.py install

4. Django確認
$ python
Python 2.5.1 (r251:54863, Jul 10 2008, 17:24:48)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import django
>>> django.VERSION
(1, 1, 1, ‘final’, 0)
>>>

5. Apache設定

5.1 httpd.conf か python.conf にmod_pythonをロードさせる
LoadModule python_module modules/mod_python.so

5.2 相対パスの場合
<Location “/myapp/”>
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath “[‘{DocumentRoot}/myapp’,'{DocumentRoot}’ ] + sys.path”
SetEnv DJANGO_SETTINGS_MODULE dxshop.settings
PythonOption django.root /myapp
#PythonDebug On
</Location>

5.3 サブドメインの場合
<VirtualHost *:80>
ServerName myapp.gedero.com
DocumentRoot {path}/myapp
SetEnv DJANGO_SETTINGS_MODULE myapp.settings
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonPath “[‘{path}/myapp’,'{path}’] + sys.path”
<Location “/media”>
SetHandler None
</Location>
</VirtualHost>

5.4 django アドミンmedia設定
ln -s /usr/lib/python2.5/site-packages/django/contrib/admin/media media

Comments

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS