惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
U
Unit 42
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
L
Lohrmann on Cybersecurity
Blog — PlanetScale
Blog — PlanetScale
Recorded Future
Recorded Future
D
DataBreaches.Net
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
I
Intezer
P
Palo Alto Networks Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
I
InfoQ
宝玉的分享
宝玉的分享
Security Latest
Security Latest
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threatpost
Cisco Talos Blog
Cisco Talos Blog
P
Proofpoint News Feed
博客园 - 司徒正美
H
Hacker News: Front Page
Y
Y Combinator Blog
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
NISL@THU
NISL@THU
月光博客
月光博客
有赞技术团队
有赞技术团队
Cloudbric
Cloudbric
酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
A
Arctic Wolf
博客园 - 【当耐特】
W
WeLiveSecurity
V
Visual Studio Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
V2EX
C
Cyber Attacks, Cyber Crime and Cyber Security
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog

博客园 - nasiry

转入墙内:SAS HBA crossflashing or flashing to IT mode, Dell Perc H200 and H310 从下往上看--新皮层资料的读后感 第四部分 来自神经元的设计-perceptron 感知机 从下往上看--新皮层资料的读后感 第三部分 70年前的逆向推演- 从NN到ANN 从下往上看--新皮层资料的读后感 第二部分:突触Synapses 从下往上看--新皮层资料的读后感 第一部分:皮层细胞 Android 6编译环境搭建 (Marshmallow) aliyun source.list 建站随手记:about server stack 摘抄---USB RNDIS/CDC White Paper January 15, 2003 指针错位导致对FSD误判 摘抄--Multithreaded Programming on the Pocket PC with Visual C++ Touchpad驱动分析 摘录----What Is MTP? (Sidebar) 摘录---PlaysForSure/Napster to Go Testing 摘录---Windows CE API机制初探 摘录---Hacking Windows CE 串口驱动分析-未完成 摘抄--------See mips RUN中文版 摘抄---非技术---追梦—SQUARE大传
建站随手记:installation python virtualenv mezzanine -1
nasiry · 2014-01-17 · via 博客园 - nasiry

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() * 2 + 1
#old method have problem with the system use multiprocessing class for replacement
#workers = (os.sysconf("SC_NPROCESSORS_ONLN") * 2) + 1 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!

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.