django项目:

依赖包
[root@web01 ~]# yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ openssl-devel zlib zlib-devel -y

1.安装python3

[root@web01 ~]# wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
[root@web01 ~]# tar xf Python-3.6.2.tgz
[root@web01 ~]# cd Python-3.6.2/
[root@web01 Python-3.6.2]# ./configure --prefix=/usr/local/
[root@web01 Python-3.6.2]# make && make install
[root@web01 Python-3.6.2]# ./configure && make && make install

2.安装Django框架和uwsgi

vim re.txt
asn1crypto==0.24.0
beautifulsoup4==4.6.3
bs4==0.0.1
certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
Click==7.0
cryptography==2.3.1
Django==1.11.9
Flask==1.0.2
Flask-Cors==3.0.6
gevent==1.3.6
greenlet==0.4.15
idna==2.7
ItsDangerous==1.1.0
Jinja2==2.10
lxml==4.2.6
MarkupSafe==1.0
numpy==1.15.3
Pillow==5.3.0
pycparser==2.18
PyMySQL==0.9.2
pytz==2018.7
requests==2.19.1
selenium==3.141.0
six==1.11.0
urllib3==1.23
virtualenv==16.1.0
Werkzeug==0.14.1
wordcloud==1.5.0

pip3 install -i https://pypi.doubanio.com/simple/ -r re.txt
pip3 install -i https://pypi.doubanio.com/simple/ uwsgi

3.测试uwsgi是否正常,新建 test.py文件,内容如下:

[root@web01 ~]# vim test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello Django"]

#然后在终端运行:
uwsgi --http :8001 --wsgi-file test.py &

4.测试django是否正常,运行:

root@web01 ~]# django-admin.py startproject demosite
[root@web01 ~]# cd demosite
[root@web01 demosite]# python3 manage.py runserver 0.0.0.0:8002
在浏览器内输入:http://127.0.0.1:8002,检查django是否运行正常。

5.配置uwsgi

[root@web01 demosite]# vim /root/demosite/uwsgi.ini
[uwsgi]
socket = 127.0.0.1:9999
master = true
workers = 2
max-requests = 1000
buffer-size = 30000
pidfile = /run/uwsgi.pid
daemonize = /var/log/uwsgi.log

uwsgi --ini /root/demosite/uwsgi.ini &

6.配置Nginx

[root@web01 demosite]# vim /etc/nginx/conf.d/py.conf
server {
listen 80;
server_name 10.0.0.100;
client_max_body_size 100M;

location / {
index index.html;
include uwsgi_params;
uwsgi_pass 127.0.0.1:9999;
uwsgi_param UWSGI_SCRIPT demosite.wsgi;
uwsgi_param UWSGI_CHDIR /root/demosite;
}
}

重启nginx

最新文章

  1. [spring源码学习]六、IOC源码-BeanFactory和factory-bean
  2. Web开发技术发展历史
  3. AJAX需要注意的
  4. BZOJ3569 : DZY Loves Chinese II
  5. android对象关系映射框架ormlite之一对多(OneToMany)
  6. PAT-乙级-1015. 德才论 (25)
  7. AutoBackupForApps
  8. 关于JPush使用CPU占有率100%的情况
  9. [置顶] Android安全机制分析
  10. jqueryui datepicker refresh
  11. Cocos2dx 3.0 过渡篇(三十一)ValueVector和Vector不得不说的故事
  12. let and const
  13. P2520 [HAOI2011]向量
  14. Leetcode_101_Symmetric Tree
  15. RocketMQ从3.5.8升级到4.3.2版本实战记录
  16. Servlet学习笔记(1)
  17. eclipse 创建springboot项目
  18. 利用Python中SocketServer 实现客户端与服务器间非阻塞通信
  19. C# 开发Modbus Rtu客户端 modbus测试Demo,Modbus 串口通信 , 虚拟MODBUS-RTU测试
  20. Gravitee.io Access Management docker-compose运行

热门文章

  1. springboot+mybatis+springMVC基础框架搭建
  2. less 写关键帧动画
  3. IDEA窗口重置
  4. 用servlet打内容到网页上
  5. android app使用微信登录接口回调没有被执行的问题研究
  6. Scala学习教程笔记三之函数式编程、集合操作、模式匹配、类型参数、隐式转换、Actor、
  7. asp.net mvc自动压缩文件,并生成CDN引用
  8. shell界面执行mysql命令
  9. 2018牛客网暑假ACM多校训练赛(第四场)E Skyline 线段树 扫描线
  10. springboot(@Service,@Mapper)注解失效导致无法注入service和mapper