python的线上环境配置
1.安装python 2.7 http://www.cnblogs.com/strikebone/p/3970512.html
2.安装相关前置工具 pip, Django
http://www.cnblogs.com/strikebone/p/3958897.html
3.安装mysql的组件 http://www.cnblogs.com/strikebone/p/3975372.html
4.安装apxs, mod_wsgi
yum install httpd-devel.x86_64
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.3.0.tar.gz
4.搞定apache的配置
在Apache配置文件httpd.conf中,增加一行:
LoadModule wsgi_module modules/mod_wsgi.so
<VirtualHost *:9000>
ServerName 127.0.0.1
DocumentRoot /home/q/abc/firstsite
WSGIScriptAlias / /home/q/abc/apache/django.wsgi
<Directory />
Order deny,allow
Allow from all
</Directory>
<Directory /home/q/abc/firstsite/static>
Allow from all
</Directory>
alias /static/ /home/q/abc/firstsite/static/
</VirtualHost>
遇到问题可以参考这个文章:
http://abloz.com/2012/10/26/compile-and-install-apache-python-module-mod_wsgi.html
问题:访问500,看apache错误日志:Exception occurred processing WSGI script '/var/www/server/apache/django.wsgi'.
AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
问题解决:
from
django.core.wsgi
import
get_wsgi_application
application
=
get_wsgi_application()
posted on 2014-09-30 12:52 strikebone 阅读(980) 评论(0) 编辑 收藏 举报