资源描述:
《python-apache安装手册》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、安装Python、Apache及其组件mod_wsgi:PythonWSGIadaptermoduleforApache1.安装Pythonwgethttp://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2tarxjvfPython-2.7.4.tar.bz2./configure--enable-shared//必须启用共享库makemakeinstall默认安装路径:/usr/local/binlib/usr/local/lib/python2.7/lib-dynlo
2、ad/添加共享库:echo"/usr/local/lib">>/etc/ld.so.conf.d/python2.7.confldconfig//重新加载库文件2.安装Apachewgethttp://labs.mop.com/apache-mirror//httpd/httpd-2.2.23.tar.bz2wgethttp://www.apache.org/dist/httpd/httpd-2.2.23.tar.gz.md5./configure--with-included-apr//Forcetheuseofthebundl
3、edapr/apr-utilmakemakeinstall3.Apache环境支持Apache1.3、2.0和2.2,针对于2.0和2.2版本MPMs可以使用单线程的“prefork”或多线程的“worker”。如果通过编译方式安装Apache,需要编译是启用ApacheRuntime(APR)libraries;如果通过rpm方式安装Apache,你必须安装相应Apache的“dev”软件包。安装方法:yuminstallhttpd-devel1.Python环境支持的版本不低于Python2.3或3.0如果编译安装需要支持“t
4、hreading”(线程);如果通过rpm安装,你必须安装相应Python的dev软件包安装方法:yuminstallpython-devel2.安装wsgi#wsgi3.4不支持CentOS6.4(httpd-2.2.15-26.el6)wgethttp://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz92ebc48e60ab658a984f97fd40cb71e0ae895469SHA1tarxzvfmod_wsgi-3.4.tar.gz//解压文件配置源代码./config
5、ure--with-apxs=/usr/local/apache2/bin/apxs--with-python=/usr/local/bin/pythonmakemakeinstall载入wsgi模块修改Apache配置文件/etc/httpd/conf/httpd.conf添加:LoadModulewsgi_modulemodules/mod_wsgi.so1.Django安装过程Django与Python的支持列表DjangoversionPythonversions1.02.3,2.4,2.5,2.61.12.3,2.4,2
6、.5,2.61.22.4,2.5,2.6,2.71.32.4,2.5,2.6,2.71.42.5,2.6,2.71.5(future)2.6,2.7,3.x(experimental)安装步骤:wgethttps://www.djangoproject.com/download/1.4.5/tarball/cdDjango-1.4.5pythonsetup.pyinstall验证安装:#python>>>importdjango>>>printdjango.get_version()1.3.4//显示版本号,安装成功1.配置Apa
7、chevim/data/apache2221/conf/httpd.confLoadModulewsgi_modulemodules/mod_wsgi.soWSGIScriptAlias/wsgi//var/www/wsgi/Orderallow,denyAllowfromall测试:http://172.17.17.20/wsgi/hello.py启动apache出错信息:httpd:Couldnotreliablydeterminetheserver'
8、sfullyqualifieddomainname,using10.240.4.35forServerName解决方法:修改httpd.conf文件配置ServerName<主机名/IP>:80(绑定域名)1.安装SQLite先安装SQLite再安