==[[Django インストール1インストール]]1.5.1==
[[CentOS]] | [[Python]] | [[MySQL]] | [[Django]] | [[Django インストール]] |
http://docs.djangoproject.com/en/dev/intro/install/
==Pythonのインストール[[Python]]のインストール==*[[CentOS6にPython2.7をインストール]]
==MySQLのインストール[[MySQL]]のインストール==*[[MySQL]]
==Djangoのインストール[[Django]]のインストール==
*https://www.djangoproject.com/
===ダウンロードと解凍===
# wget https://www.djangoproject.com/download/1.5.1/tarball/
# tar xvf [[Django]]-1.5.1.tar.gz
===インストール===
*上記でインストールしたPython2上記でインストールした[[Python]]2.7にインストール # cd [[Django]]-1.5.1
# python2.7 setup.py install
===[[MySQL]]-pythonのインストール=== # wget --no-check-certificate https://pypi.python.org/packages/source/M/[[MySQL]]-python/[[MySQL]]-python-1.2.4.zip#md5=ddf2386daf10a97af115ffad2ed4a9a0 # unzip [[MySQL]]-python-1.2.4.zip # cd [[MySQL]]-python-1.2.4
# python2.7 setup.py instal
==modwsgi==
*http://docs.nullpobug.com/django-doc-ja/trunk/howto/deployment/modwsgi.html
*Apache と mod_wsgi の組み合わせは、推奨の [[Django ]] の実運用環境です。
===modwsgi のインストール===
*http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide
=====以下のようなエラーがでる=====
Cannot load /etc/httpd/modules/mod_wsgi.so into server:
/etc/httpd/modules/mod_wsgi.so: undefined symbol: RAND_status[[R]]AND_status
====modwsgi====
*http://code.google.com/p/modwsgi/downloads/list
# tar xvf mod_wsgi-3.4.tar.gz
=====インストール=====
*Pythonのパスに上記でインストールしたPython2[[Python]]のパスに上記でインストールした[[Python]]2.7を指定
# cd mod_wsgi-3.4
# ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python2.7
*/etc/httpd/conf.d/wsgi.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonPath WSGI[[Python]]Path /home/myname/mysite
WSGIScriptAlias / /home/myname/mysite/myapp/myapp.py
*http://docs.djangoproject.jp/ja/latest/howto/static-files.html
=====settings.py 例=====
STATIC_URL STATIC_U[[R]]L = '/static/' STATIC_ROOT STATIC_[[R]]OOT = '/home/myname/static/'
=====テンプレート中の記述=====
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL STATIC_U[[R]]L }}css/myapp.css">
=====配置=====
./manage.py collectstatic
=====wsgi.conf に Aliasを追記=====
Alias /static/ "/home/myname/static/"