建站随手记: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
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的更多相关文章
- 建站随手记:about server stack
建站需要,随手记: Server Stack: ----------- 标准的mezzanine的Stack设置 前端:Nginx wsgi:gunicorn cms tool: mezzanine ...
- Drupal 7 建站学习手记(四):怎样改动Nivo Slider模块的宽高
背景 Nivo Slider模块默认大小是用的height: 100%, width 100%, 但IE7及下面的浏览器是不支持百分比宽高的, 而我的项目目标用户基本都是使用XP系统,项目需求是必须兼 ...
- Drupal 7 建站学习手记(五):QuickTabs模块内的元素无法溢出的问题
背景 项目要求站点首页放Views生成的区块,而且要求有很多其它链接. Views生成的区块默认的很多其它链接仅仅能选在列表上方和下方 下图是默认在上方的样式图: 为了美观.我将很多其它链接上移了若干 ...
- Python快速建站系列-Part.One-组装开发环境
|版权声明:本文为博主原创文章,未经博主允许不得转载. 源代码都在github上:SmallStudyStation 现在是个demo,但回来会租个服务器,等功能完善了放到服务器上挂着,域名jusot ...
- 【从0開始Tornado建站】0.9版本号python站点代码开源--持续更新中
从5月份開始[从0開始Tornado建站]这个专栏,開始一点一点把这个分类兴趣站点弄起来,从无到有的过程也是令人兴奋的:-) 国庆的时候等待备案然后上线,如今站点域名为ustchack ...
- Python+Flask+MysqL的web技术建站过程
1.个人学期总结 时间过得飞快,转眼间2017年就要过去.这一年,我学习JSP和Python,哪一门都像一样新的东西,之前从来没有学习过. 这里我就用我学习过的Python和大家分享一下,我是怎么从一 ...
- Python快速建站系列-Part.Three-注册和登录
|版权声明:本文为博主原创文章,未经博主允许不得转载. 上一个Part已经给TSSS编好了一个简单的Web服务,网页的基础模版也写好了,那从这个Part开始就慢慢增加编写功能. 先写基础功能:注册和登 ...
- (转) 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 ...
- 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 ...
随机推荐
- nginx+tomcat+二级域名静态文件分离支持mp4视频播放配置实例
nginx+tomcat+二级域名静态文件分离支持mp4视频播放配置实例 二级域名配置 在/etc/nginx/conf.d/目录下配置二级域名同名的conf文件,路径改成对应的即可 statics. ...
- MKRCVCD-MKRCVCDSER.exe can't start in service
Logfile contents: 2016/11/23 02:15:09 NamePipeSer Log Start.2016/11/23 02:15:09 Start C:\Program Fil ...
- ResultSet相关ResultSetMetaData详细
DatabaseMetaData 有关整个数据库的信息:表名.表的索引.数据库产品的名称和版本.数据库支持的操作. ResultSet 关于某个表的信息或一个查询的结果.您必须逐行访问数据行,但是您可 ...
- java树形目录展示
package test; import java.awt.Component;import java.awt.Container;import java.util.ArrayList;import ...
- python 列表排序
转自http://www.iplaypython.com/jinjie/jj114.html reverse()方法 将列表中元素反转排序,比如下面这样>>> x = [1,5,2, ...
- dataRow转化为对象
对象类名useInfo,int,short,string,DateTime格式如下: userInfo.ErrorTimes = int.Parse(dataRow["ErrorTimes& ...
- RK 61 键盘 Ubuntu 下键位映射修改方案
在用户 Home 目录下面创建 .Xmodmap 文件,然后输入以下的内容: remove Lock = Caps_Lock remove Control = Control_L remove Con ...
- Linux内核分析:dup、dup2的实现
一.首先需要看一下这两个函数的作用: #include <unistd.h> int dup(int oldfd); int dup2(int oldfd, int newfd); 根据m ...
- highcharts php请求mysql返回json数据作为数据源进行制图
直接上代码 [官方文档请参见http://www.highcharts.com/docs/working-with-data/getting-data-across-domains-jsonp] [实 ...
- python之初级学习
一.python安装 1.下载安装包(本人使用python3.5.1) https://www.python.org/downloads/ 2.安装python-3.5.1.exe 本人下载的是pyt ...