まずは、django のソースをダウンロードし、インストールする。
なお、setup.py を実行する際は、必ず、python 2.6 を使用する。
wget http://www.djangoproject.com/download/1.4.5/tarball/ tar xzvf Django-1.4.5.tar.gz cd Django-1.4.5 python26 setup.py install次に、django プロジェクトを作成する。
mkdir /var/www/cgi-bin/django cd /var/www/cgi-bin/django django-admin.py startproject testproject開発用サーバを起動し、別端末より、django が動作することを確認する。
cd /var/www/cgi-bin/django/testproject python26 manage.py runserver
curl http://localhost:8000/ <!DOCTYPE html> <html lang="en"><head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="NONE,NOARCHIVE"><title>Welcome to Django</title> ・・・ <div id="explanation"> <p> You're seeing this message because you have <code>DEBUG = True</code> in your Django settings file and you haven't configured any URLs. Get to work! </p> </div> </body></html>apache 側の設定をpython26-mod_wsgi.conf へ記載する。
WSGIScriptAlias /django /var/www/cgi-bin/django/testproject/testproject/wsgi.py WSGIPythonPath /var/www/cgi-bin/django/testproject <IfModule !python_module> <IfModule !wsgi_module> LoadModule wsgi_module modules/python26-mod_wsgi.so </IfModule> </IfModule> <Directory /var/www/cgi-bin/django/testproject/testproject> Order deny,allow Allow from all </Directory>apache を再起動し、apache経由でdjangoの動作を確認する。
service httpd restart
curl http://localhost/django/ <!DOCTYPE html> <html lang="en"><head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="NONE,NOARCHIVE"><title>Welcome to Django</title> ・・・ <div id="explanation"> <p> You're seeing this message because you have <code>DEBUG = True</code> in your Django settings file and you haven't configured any URLs. Get to work! </p> </div> </body></html>
0 件のコメント:
コメントを投稿