wsgi设置有什么问题?

时间:2018-07-03 23:48:42

标签: python django uwsgi

我正在尝试设置uwsgi(最终设置为nginx),但现在卡在了uwsgi上。尝试正常运行服务器时出现以下错误:

could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

这是运行命令uwsgi --http:8000 --module Hellfish.wsgi的输出:

*** Starting uWSGI 2.0.17 (64bit) on [Tue Jul  3 18:34:40 2018] ***
compiled with version: 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2) on 03 July 2018 20:44:01
os: Darwin-16.7.0 Darwin Kernel Version 16.7.0: Fri Apr 27 17:59:46 PDT 2018; root:xnu-3789.73.13~1/RELEASE_X86_64
nodename: Whodinis-MacBook-Pro.local
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /Users/whodini/Desktop/who/Web/Hellfish
detected binary path: /Users/whodini/Desktop/who/Web/Hellfish/env/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 709
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8000 fd 5
spawned uWSGI http 1 (pid: 70999)
uwsgi socket 0 bound to TCP address 127.0.0.1:59020 (port auto-assigned) fd 4
Python version: 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06)  [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7fd92082c800
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72888 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
base dir path
Traceback (most recent call last):
  File "./Hellfish/wsgi.py", line 16, in <module>
    application = get_wsgi_application()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
    module = import_module(entry)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'django_countries'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 70998, cores: 1)

不确定为什么无法导入模块Django_countries。我有点盲目,因为这是我第一次这样做,在阅读文档和教程时遇到了麻烦。我试图杀死该端口并重新启动它,但是再次出现了此问题。也不确定我的.ini文件是否在正确的位置,或者其配置是否正确。我将其放在与Hellfish.wsgi文件相同的目录中。地狱鱼是我项目的名称。最后,这是我的.ini文件的内容:

[uwsgi]

socket = 127.0.0.1:8000

chdir = /Users/whodini/Desktop/who/Web/Hellfish/
home = /Users/whodini/Desktop/who/Web/Hellfish/env
module = Hellfish.wsgi:application
wsgi-file = Hellfish/wsgi.py
master = true
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000

processes = 4
threads = 2
stats = 127.0.0.1:8000

这里的一些帮助将不胜感激。

0 个答案:

没有答案