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

gunicorn18.0 droped gunicorn_django so let's use old version.

pip install gunicorn==17.5
#make www-data own the folder
chown -R www-data:www-data /srv/www

2.test gunicorn

gunicorn siteroot.wsgi:application --bind 0.0.0.0:80

3.add gunicorn conf to project root

#we use the code from deploy/gunicorn.conf.py
from __future__ import unicode_literals
import os
import multiprocessing bind = "127.0.0.1:8023"
workers = multiprocessing.cpu_count() * + 1
#old method have problem with the system use multiprocessing class for replacement
#workers = (os.sysconf("SC_NPROCESSORS_ONLN") * ) +
loglevel = "error"
proc_name = "openivi"

4. install supervisor

apt-get install supervisor ngnix

5.make gunicorn run while reboot

vi /etc/supervisor/conf.d/openivi.conf
#add codes below

[group:openivi]
programs=gunicorn_openivi


[program:gunicorn_openivi]
command=/datadsk/siteroot/bin/gunicorn_django -c gunicorn.conf.py -p gunicorn.pid
directory=/datadsk/siteroot/openivi
user=root
autostart=true
autorestart=true
redirect_stderr=true
environment=PATH="/datadsk/siteroot/bin"

 

6.try it!

 supervisorctl reload

CSS won't be found when we use gunicorn, let nginx do with the statics.

Step4.Work with Nginx

we already installed ngnix in step3

1.config it! Add file to /ete/nginx/sites-enabled/openivi.conf as below.

upstream openivi {
server 127.0.0.1:8023;
} server {
listen 80;
# listen 443 ssl;
server_name localhost;
client_max_body_size 10M;
keepalive_timeout 15; # ssl_certificate conf/%(proj_name)s.crt;
# ssl_certificate_key conf/%(proj_name)s.key;
# ssl_session_cache shared:SSL:10m;
# ssl_session_timeout 10m;
# ssl_ciphers RC4:HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_pass http://openivi;
} location /static/ {
root /datadsk/siteroot/openivi;
access_log off;
log_not_found off;
} location /robots.txt {
root /datadsk/siteroot/openivi/static;
access_log off;
log_not_found off;
} location /favicon.ico {
root /datadsk/siteroot/openivi/static/img;
access_log off;
log_not_found off;
} }

@we used nginx for static pass-though, don't forget to collect all static file to the root folder. manage.py have this feature which provided by django framework.

 Test it ,Shoud be works.

建站随手记:installation python virtualenv mezzanine -1的更多相关文章

  1. 建站随手记:about server stack

    建站需要,随手记: Server Stack: ----------- 标准的mezzanine的Stack设置 前端:Nginx wsgi:gunicorn cms tool: mezzanine ...

  2. Drupal 7 建站学习手记(四):怎样改动Nivo Slider模块的宽高

    背景 Nivo Slider模块默认大小是用的height: 100%, width 100%, 但IE7及下面的浏览器是不支持百分比宽高的, 而我的项目目标用户基本都是使用XP系统,项目需求是必须兼 ...

  3. Drupal 7 建站学习手记(五):QuickTabs模块内的元素无法溢出的问题

    背景 项目要求站点首页放Views生成的区块,而且要求有很多其它链接. Views生成的区块默认的很多其它链接仅仅能选在列表上方和下方 下图是默认在上方的样式图: 为了美观.我将很多其它链接上移了若干 ...

  4. Python快速建站系列-Part.One-组装开发环境

    |版权声明:本文为博主原创文章,未经博主允许不得转载. 源代码都在github上:SmallStudyStation 现在是个demo,但回来会租个服务器,等功能完善了放到服务器上挂着,域名jusot ...

  5. 【从0開始Tornado建站】0.9版本号python站点代码开源--持续更新中

            从5月份開始[从0開始Tornado建站]这个专栏,開始一点一点把这个分类兴趣站点弄起来,从无到有的过程也是令人兴奋的:-) 国庆的时候等待备案然后上线,如今站点域名为ustchack ...

  6. Python+Flask+MysqL的web技术建站过程

    1.个人学期总结 时间过得飞快,转眼间2017年就要过去.这一年,我学习JSP和Python,哪一门都像一样新的东西,之前从来没有学习过. 这里我就用我学习过的Python和大家分享一下,我是怎么从一 ...

  7. Python快速建站系列-Part.Three-注册和登录

    |版权声明:本文为博主原创文章,未经博主允许不得转载. 上一个Part已经给TSSS编好了一个简单的Web服务,网页的基础模版也写好了,那从这个Part开始就慢慢增加编写功能. 先写基础功能:注册和登 ...

  8. (转) Web 建站技术中,HTML、HTML5、XHTML、CSS、SQL、JavaScript、PHP、ASP.NET、Web Services 是什么?

    Web 建站技术中,HTML.HTML5.XHTML.CSS.SQL.JavaScript.PHP.ASP.NET.Web Services 是什么? 建站有很多技术,如 HTML.HTML5.XHT ...

  9. Web 建站技术中,HTML、HTML5、XHTML、CSS、SQL、JavaScript、PHP、ASP.NET、Web Services 是什么(转)

    Web 建站技术中,HTML.HTML5.XHTML.CSS.SQL.JavaScript.PHP.ASP.NET.Web Services 是什么?修改 建站有很多技术,如 HTML.HTML5.X ...

随机推荐

  1. thinkPHP 5.0.x 使用SQLite3 进行缓存设置 Cache

    1. 配置 thinkPHP cache [application/config.php] 把type设置为sqlite3(默认是小写,第一个字母不区分大小写) 把path换成db,并指定sqlite ...

  2. List 用法和实例(转载)

    写在粘贴复制前:英文的感觉也可以,也能看的懂,多看看英文资料没坏处的 Problem. You have questions about the List collection in the .NET ...

  3. MarkDown简要语法

    1.标题 2.列表 3. 引用 4.图片与连接 实现链接有两种方式,分别是内联方式和引用方式 内联方式 [This baidu link](http://www.baidu.com)效果如:This ...

  4. 2016 ACM赛后总结

    已经到6.30号了哎~ 比赛是6.5号的,被推迟了好久的总结现在发吧,因为我怕我再不写就真的会忘掉-- 6.3号晚,星期五,我们一行人乘坐 济南<->徐州 的火车,然后出发了-- 6.4号 ...

  5. Web Service简介 内部资料 请勿转载 谢谢合作

    1.1.Web Service基本概念 Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求, ...

  6. 初学者-ASCII码 数字转字母

    var index=1; var byt = new byte[1] {(byte) (index + 64)}; var grade = Encoding.ASCII.GetString(byt); ...

  7. day4总结

    函数是什么? 函数一词来源于数学,但编程中的「函数」概念,与数学中的函数是有很大不同的,具体区别,我们后面会讲,编程中的函数在英文中也有很多不同的叫法.在BASIC中叫做subroutine(子过程或 ...

  8. 数据库中的左连接(left join)和右连接(right join)区别

    Left Join / Right Join /inner join相关 关于左连接和右连接总结性的一句话: 左连接where只影向右表,右连接where只影响左表. Left Join select ...

  9. MATLAB地图工具箱学习总结(一)从地图投影说起

    MATLAB地图工具箱学习总结(一)从地图投影说起 前言 本学期地图投影课上,李连营老师建议我们使用MATLAB完成每周的作业.从大二上学期开始接触MATLAB学习数学运算和地理数据处理的我,自然不会 ...

  10. 115个Java面试题和答案——终极列表(上)

    本文我们将要讨论Java面试中的各种不同类型的面试题,它们可以让雇主测试应聘者的Java和通用的面向对象编程的能力.下面的章节分为上下两篇,第一篇将要讨论面向对象编程和它的特点,关于Java和它的功能 ...