[root@133 simplecmdb]# cd /opt/python/django/simplecmdb-gunicorn/ [root@133 simplecmdb-gunicorn]# ls
112.65.140.132 exit hostinfo manage.py nohup.out simplecmdb sysinformation-pickle.py
[root@133 simplecmdb-gunicorn]# gunicorn simplecmdb.wsgi:application -D
Could not find platform independent libraries
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
ImportError: No module named site
根据提示:安装site模块
[root@133 simplecmdb-gunicorn]# pip install site
Collecting site
/opt/amos/python2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/opt/amos/python2.7/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading site-0.0.1.tar.gz
Installing collected packages: site
Running setup.py install for site ... done
Successfully installed site-0.0.1
[root@133 simplecmdb-gunicorn]# vim /etc/profile
export PYTHONHOME=/opt/amos/python2.7
[root@133 simplecmdb-gunicorn]# source /etc/profile
[root@133 simplecmdb-gunicorn]# echo $PYTHONHOME
/opt/amos/python2.7
[root@133 simplecmdb-gunicorn]# pwd
/opt/python/django/simplecmdb-gunicorn
[root@133 simplecmdb-gunicorn]# gunicorn simplecmdb.wsgi:application -D
[root@133 simplecmdb-gunicorn]# netstat -anput | grep :80
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 8106/python2.7
tcp 0 0 112.65.140.133:8000 0.0.0.0:* LISTEN 7817/nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7817/nginx
tcp 0 531 112.65.140.133:63251 182.50.136.239:80 FIN_WAIT1 -
tcp 0 0 :::80 :::* LISTEN 7817/nginx
可以看到-D 指定的127.0.0.1上开启的端口