CentOS7 deploy Django project

1. Update the system packages

yum update -y

2. Install the software management packages and dependencies that may be used

yum -y groupinstall "Development tools"
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

3. Install python3, pip3 and establish a flexible connection (add environment variables) (Click to view)

4. By mounting pip Django, uwsgi

pip install django
pip install uwsgi

5. (New Folder used to store items) to enter the specified folder, create a Django project and run (click to view)

6. Configure uwsgi, create mysite.xml file in the project directory, write:

<uwsgi>
   <socket>127.0.0.1:8997</socket><!-- 内部端口,自定义 -->
   <chdir>/data/wwwroot/mysite/</chdir><!-- 项目路径 -->
   <module>mysite.wsgi</module>
   <processes>4</processes><!-- 进程数 -->
   <daemonize>uwsgi.log</daemonize><!-- 日志文件 -->
</uwsgi>

(Note where the project name must be identical)

7. Install and configure nginx (Click to view)

8. Start uwsgi

Into the project folder (there mysite.xml of), start uwsgi: uwsgi -x mysite.xml

9. Restart nginx

Nginx into the folder: cd /usr/local/nginx/sbin/restart./nginx -s reload

Problems may occur


Error:

uwsgi: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

Solution:sudo ln -s ~/anaconda3/lib/libssl.so.1.1 /lib64/libssl.so.1.1


Error:

uwsgi: error while loading shared libraries: libcrypto.so.1.1:

Solution:sudo ln -s ~/anaconda3/lib/libcrypto.so.1.1 /lib64/libcrypto.so.1.1


Error:

uwsgi: error while loading shared libraries: libicui18n.so.58

Solution:
sudo ln -s ~/anaconda3/lib/libicui18n.so.58 /lib64/libicui18n.so.58
sudo ln -s ~/anaconda3/lib/libicuuc.so.58 /lib64/libicuuc.so.58
sudo ln -s ~/anaconda3/lib/libicudata.so.58 /lib64/libicudata.so.58


Error:

uwsgi: /lib64/./libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /lib64/libicui18n.so.58)

Solution:
sudo rm -rf /lib64/libstdc++.so.6
sudo ln -s /home/ian/anaconda3/lib/libstdc++.so.6.0.25 /lib64/libstdc++.so.6

Guess you like

Origin www.cnblogs.com/dbf-/p/11031910.html
Recommended