yum install sqlite-devel -y
wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz tar xf Python-2.7.8.tgz cd Python-2.7.8 ./configure --prefix=/usr/local make && make install
# First get the setup script for Setuptools: wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py # Then install it for Python 2.7 : python2.7 ez_setup.py # Now install pip using the newly installed setuptools: easy_install-2.7 pip # With pip installed you can now do things like this: pip2.7 install [packagename] pip2.7 install --upgrade [packagename] pip2.7 uninstall [packagename]
# Install virtualenv for Python 2.7 and create a sandbox called my27project: pip2.7 install virtualenv virtualenv-2.7 my27project # Check the system Python interpreter version: python --version # This will show Python 2.6.6 # Activate the my27project sandbox and check the version of the default Python interpreter in it: source my27project/bin/activate python --version # This will show Python 2.7.X deactivate
$ sudo pip install supervisor
$ mkdir /tmp/wwwroot/web1 $ cd /tmp/wwwroot/web1 $ virtualenv deps $ source deps/bin/activate $ pip install flask gunicorn
$ cat > myapp.py << EOF
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "hello flask 01"
$ gunicorn -b 127.0.0.1:3721 myapp:app
$ cd /tmp/wwwroot $ echo_supervisord_conf > supervisor.conf $ cat >> supervisor.conf << EOF
[program:myapp] ;user=digwtx command=/tmp/wwwroot/web1/deps/bin/gunicorn -b 127.0.0.1:3721 myapp:app directory=/tmp/wwwroot/web1 process_name=%(program_name)s ; process_name expr (default %(program_name)s) numprocs=1 ; number of processes copies to start (def 1) stopsignal=QUIT ; signal used to kill process (default TERM) redirect_stderr=true ; redirect proc stderr to stdout (default false) stdout_logfile=/tmp/myapp.log ; stdout log path, NONE for none; default AUTO
$ supervisord -c supervisor.conf
$ supervisorctl -c supervisor.conf
server {
listen 8080;
#默认请求
location / {
#请求转向本机ip:3721
proxy_pass http://127.0.0.1:3721; # 这里是gunicorn监听的地址
proxy_redirect off;
proxy_set_header Host $host:8080; #如果端口不是80要写上
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
supervisord -c /tmp/wwwroot/supervisor.conf
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有