AI智能
改变未来

构建django到服务器

  1. ssh-keygen -R XXX.XXX.XXX.XXX

  2. ssh [email protected]

  3. file zilla 上传company项目到/home

  4. cd /home

  5. apt install python3

  6. apt-get install python3-venv

  7. python3 -m venv venv

  8. source venv/bin/activate && cd company

  9. pip install –upgrade pip setuptools -i Go语言/ –trusted-host mirrors.aliyun.com

  10. pip install -r requirements.txt -i Go语言/ –trusted-host mirrors.aliyun.com

  11. 首先得保证Django项目没有问题
    python manage.py runserver 0.0.0.0:8001
    uwsgi –http :8001 –plugin python –module company.wsgi
    查看端口:netstat -ntlp //查看当前所有tcp端口·
    杀掉uwsgi进行pkill -f uwsgi -9

  12. apt-get install python3-dev

  13. apt-get install gcc

  14. pip install uwsgi

  15. uwsgi –ini uwsgi.ini

  16. ps ajx|grep uwsgi

  17. uwsgi –stop uwsgi.pid

  18. apt-get install nginx

  19. nginx -v

  20. find / -name nginx.conf

  21. ip映射功能

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8000

22.更新html文件后,服务器端要执行以下命令才能刷新:

pkill -f uwsgi -9uwsgi --ini uwsgi.ini
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » 构建django到服务器