yllplay 发表于 2018-11-14 10:06:47

gunicorn模块(django与nginx整合)

# cd /opt/python/django/simplecmdb-gunicorn/  # ls
  112.65.140.132exithostinfomanage.pynohup.outsimplecmdbsysinformation-pickle.py
  # 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模块
  # 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
  # vim /etc/profile
  export PYTHONHOME=/opt/amos/python2.7
  # source /etc/profile
  # echo $PYTHONHOME
  /opt/amos/python2.7
  # pwd
  /opt/python/django/simplecmdb-gunicorn
  # gunicorn simplecmdb.wsgi:application -D
  # 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上开启的端口

页: [1]
查看完整版本: gunicorn模块(django与nginx整合)