建站随手记:installation python virtualenv mezzanine -1
aliyun的网络访问有时会有问题,pip有问题的时候使用豆瓣源
pip install $apptoinstall$ -i http://pypi.douban.com/simple
------------------------------------------------------------------------------------
Step1.Perpare the basic packages
1.instal pip and fabric
sudo easy_install pip # no pip in ubuntu < 10, make sure sudo pip install --upgrade virtualenv virtualenvwrapper sudo pip install --upgrade ‘fabric>=1.0‘
2.install compiler
sudo apt-get --yes install build-essential python-setuptools python-dev python-software-properties
3.install C lib for PIL
这个是为mezzanine准备的,Pillow自动安装的时候不会自动装,mezzanine的上传功能不能使用。
sudo apt-get install --yes libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms1-dev libwebp-dev python-dev
----------------------------------------------------------------------------
Step 2.Setup Mezzinine in VirtualEnv
0.perpare folds
mkdir -p /srv/www/open-ivi.org/public_html/static mkdir /srv/www/open-ivi.org/application mkdir /srv/www/open-ivi.org/logs
1. create virtualenv
export WORKON_HOME=/srv/www/open-ivi.org/
mkdir $WORKON_HOME
source
/usr/local/bin/virtualenvwrapper.sh
cd $WORKON_HOME
mkvirtualenv open-ivi.org
#rmvirtualenv open-ivi.org # use this command to remove the env if you are in trouble
######################################################################
# How to enter this virtual env again
cd /srv/www/open-ivi.org/
source /srv/www/open-ivi.org/open-ivi.org/bin/activate
######################################################################
2.install packages
pip install pillow -------------------------------------------------------------------- *** TKINTER support not available --- JPEG support available --- ZLIB (PNG/ZIP) support available --- LIBTIFF support available --- FREETYPE2 support available *** LITTLECMS2 support not available --- WEBP support available *** WEBPMUX support not available -------------------------------------------------------------------- pip install mezzanine south django-compressor
3. try to work with sqlite3
mezzanine-project siteroot chmod 777 -R *.py #make it as exe cd siteroot ./manage.py createdb --noinput # usrname:admin pwd:default ./manage.py runserver 0.0.0.0:9999 #then check it with your browser
So great! It works.Then let‘s create the server stack .
------------------------------------------------------------------------------------
Step3.Make Gunicorn works
0.Make Sure django works with the deploy env
#go there to find a key :http://www.miniwebtool.com/django-secret-key-generator/
#edit siteroot/deploy/live_setting.py
SECRET_KEY =
1.install gunicorn
1 |
pip install gunicorn<br> #make www-data own the folder<br>chown -R www-data:www-data /srv/www<br><br> |
2.test gunicorn
gunicorn siteroot.wsgi:application --bind 0.0.0.0:80
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。