linux+nginx+python+django環境配置

來源:互聯網
上載者:User

Django是一個開放原始碼的Web應用程式框架,由Python寫成,它最初是被開發來用於管理勞倫斯出版集團旗下的一些以新聞內容為主的網站的。python+django也是web開發人員最受歡迎的架構.今天記錄下整個搭建開發環境的過程.(說明下環境的系統為 centos 5.2)
   一:更新yum倉庫(目前這個yum源是最快的)

[root@filerserver python]#cd /etc/yum.repos.d
[root@filerserver python]#mv CentOS-Base.repo CentOS-Base.repo.save
[root@filerserver python]#wget http://centos.ustc.edu.cn/CentOS-Base.repo.5
[root@filerserver python]#mv CentOS-Base.repo.5 CentOS-Base.repo

二:安裝部分的開發包和更新

[root@filerserver python]#yum check-update
[root@filerserver python]#yum update
[root@filerserver python]#yum install ntp iptraf sysstat screen subversion wget bzip2 nfs-utils vim-common
[root@filerserver python]#yum install make gcc gcc-c++ libjpeg-devel libpng-devel zlib-devel tcl-devel freetype-devel libevent-devel openssl-devel db4-devel curl-devel pcre-devel ncurses-devel readline-devel sqlite-devel

三:安裝Python

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/Python-2.5.4.tar.bz2
[root@filerserver python]#tar xjvf Python-2.5.4.tar.bz2
[root@filerserver python]#cd Python-2.5.4/
[root@filerserver python]#./configure --enable-unicode=ucs4
[root@filerserver python]#make
[root@filerserver python]#make install

四:安裝MySQL用戶端

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/mysql-5.0.45.tar.gz
[root@filerserver python]#tar zxvf mysql-5.0.45.tar.gz
[root@filerserver python]#cd mysql-5.0.45
[root@filerserver python]#CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
                                       -fno-exceptions -fno-rtti" ./configure \
                                       --prefix=/usr/local/mysql --enable-assembler \
                                       --with-charset=utf8 \
                                       --with-extra-charsets=gbk,gb2312,latin1 \
                                       --without-debug \
                                      --with-client-ldflags=-all-static \
                                       --enable-thread-safe-client \
                                       --without-server
[root@filerserver python]#make
[root@filerserver python]#make install
[root@filerserver python]#echo "PATH=/usr/local/mysql/bin:\$PATH" >> /etc/profile
[root@filerserver python]#echo "export PATH" >> /etc/profile
[root@filerserver python]#echo "/usr/local/mysql/lib/mysql" > /etc/ld.so.conf.d/mysql.conf
[root@filerserver python]#ldconfig

五:安裝memcached

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/memcached-1.2.6.tar.gz
[root@filerserver python]#tar xzvf memcached-1.2.6.tar.gz
[root@filerserver python]#cd memcached-1.2.6/
[root@filerserver python]#./configure --prefix=/usr/local/memcached --enable-threads
[root@filerserver python]#make
[root@filerserver python]#make install

六:安裝python setuptools

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/setuptools-0.6c9.tar.gz
[root@filerserver python]#tar xzvf setuptools-0.6c9.tar.gz
[root@filerserver python]#cd setuptools-0.6c9
[root@filerserver python]#python setup.py install

七:安裝django

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#svn co http://code.djangoproject.com/svn/django/trunk django-trunk #直接重django的SVN拿最新穩定安裝包
[root@filerserver python]#cd django-trunk
[root@filerserver python]#python setup.py install

八:安裝sqlalchemy

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#svn co http://svn.sqlalchemy.org/sqlalchemy/branches/rel_0_4 
[root@filerserver python]#cd sqlalchemy-0.4
[root@filerserver python]#python setup.py install

九:安裝MySQLdb

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/MySQL-python-1.2.2.tar.gz
[root@filerserver python]#tar xzvf MySQL-python-1.2.2.tar.gz
[root@filerserver python]#cd MySQL-python-1.2.2
[root@filerserver python]#python setup.py install

十:安裝Twisted

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/Twisted-8.2.0.tar.bz2
[root@filerserver python]#tar xjvf Twisted-8.2.0.tar.bz2
[root@filerserver python]#cd Twisted-8.2.0/
[root@filerserver python]#python setup.py install

十一:安裝python-memcached

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/python-memcached-1.44.tar.gz
[root@filerserver python]#tar xzvf python-memcached-1.44.tar.gz
[root@filerserver python]#cd python-memcached-1.44
[root@filerserver python]#python setup.py install

十二:安裝PIL

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/Imaging-1.1.6.tar.gz
[root@filerserver python]#tar xzvf Imaging-1.1.6.tar.gz
[root@filerserver python]#cd Imaging-1.1.6
[root@filerserver python]#python setup.py install

十三:安裝flup

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/flup-1.0.1.tar.gz
[root@filerserver python]#tar xzvf flup-1.0.1.tar.gz
[root@filerserver python]#cd flup-1.0.1
[root@filerserver python]#python setup.py install

十四:安裝simplejson

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/simplejson-2.0.9.tar.gz
[root@filerserver python]#tar xzvf simplejson-2.0.9.tar.gz
[root@filerserver python]#cd simplejson-2.0.9
[root@filerserver python]#python setup.py install

十五:安裝nginx

[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#wget http://www.dbasky.net/tool/python/nginx-0.7.51.tar.gz
[root@filerserver python]#tar xzvf nginx-0.7.51.tar.gz
[root@filerserver python]#cd nginx-0.7.51
[root@filerserver python]#./configure --prefix=/usr/local/nginx \
                                       --with-md5=/usr/lib \
                                       --with-sha1=/usr/lib \
                                       --with-http_ssl_module \
                                       --with-http_stub_status_module \
                                       --without-mail_pop3_module \
                                       --without-mail_imap_module \
                                       --without-mail_smtp_module \
                                        --with-http_realip_module
[root@filerserver python]#make
[root@filerserver python]#make install

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.