标签:info amp conf style run version lin roc off
# 创建虚拟环境 pyenv virtualenv online # 进入工程目录,安装包 pip install -r requirements.txt #测试 python manage,py runserver
访问httP://ip:8000
1 # 进入虚拟环境 2 pyenv activate online 3 4 pip install uwsgi 5 6 # 测试uwsgi 7 uwsgi –http :8000 –module online.wsgi
访问httP://ip:8000
1 yum install nginx
新建mx_nginx.conf
upstream django { server 127.0.0.1:8000; # for a web port socket (we‘ll use this first) } server { # the port your site will be served on listen 80; # the domain name it will serve for server_name 47.92.37.14 www.54noob.top 54noob.top; #\填你的域名或ip charset utf-8; access_log /root/mxonline/logs/access.log; error_log /root/mxonline/logs/error.log; # max upload size client_max_body_size 75M; # adjust to taste # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; #一定要跟uwsgi配置的一样 include uwsgi_params; # the uwsgi_params file you installed uwsgi_param UWSGI_SCRIPT online.wsgi; #入口文件,即wsgi.py录的位置 uwsgi_param UWSGI_CHDIR /root/mxonline/online; #项目根目录 } access_log off; }
加入nginx配置
1 ln -s conf/mx_nginx.conf /etc/nginx/conf.d/
重启nginx 或者nginx -t 、nginx -s reload
新建mx_uwsgi.ini
1 [uwsgi] 2 3 chdir = /root/mxonline/online #工程目录 4 module = online.wsgi #wsgi.py 5 master = true 6 processes = 10 7 socket = 127.0.0.1:8000 #nginx配置对应 8 vacuum = true 9 virtualenv = /root/.pyenv/versions/online #虚拟环境
nginx #启动nginx /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf #启动redis pyenv activate online #进入虚拟环境 cd ~/online #进入工程目录 uwsgi -i conf/uwsgi.ini & #启动uwsgi celery -A online worker -l info #启动celery
标签:info amp conf style run version lin roc off
原文地址:http://www.cnblogs.com/wj5633/p/6676094.html