Python Django+;Nginx+;uWSGI:内部服务器错误

Python Django+;Nginx+;uWSGI:内部服务器错误,python,django,nginx,uwsgi,Python,Django,Nginx,Uwsgi,当我试图获取我的站点时,我得到一个“内部服务器错误”。以下是日志文件中的内容: Tue May 9 02:46:31 2017 - *** Starting uWSGI 1.9.17.1-debian (64bit) on [Tue May 9 02:46:31 2017] *** Tue May 9 02:46:31 2017 - compiled with version: 4.8.2 on 23 March 2014 17:15:32 Tue May 9 02:46:31 2017

当我试图获取我的站点时,我得到一个“内部服务器错误”。以下是日志文件中的内容:

Tue May  9 02:46:31 2017 - *** Starting uWSGI 1.9.17.1-debian (64bit) on [Tue May  9 02:46:31 2017] ***
Tue May  9 02:46:31 2017 - compiled with version: 4.8.2 on 23 March 2014 17:15:32
Tue May  9 02:46:31 2017 - os: Linux-3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015
Tue May  9 02:46:31 2017 - nodename: ip-172-31-24-23
Tue May  9 02:46:31 2017 - machine: x86_64
Tue May  9 02:46:31 2017 - clock source: unix
Tue May  9 02:46:31 2017 - pcre jit disabled
Tue May  9 02:46:31 2017 - detected number of CPU cores: 1
Tue May  9 02:46:31 2017 - current working directory: /
Tue May  9 02:46:31 2017 - writing pidfile to /run/uwsgi/app/landingpage/pid
Tue May  9 02:46:31 2017 - detected binary path: /usr/bin/uwsgi-core
Tue May  9 02:46:31 2017 - setgid() to 33
Tue May  9 02:46:31 2017 - setuid() to 33
Tue May  9 02:46:31 2017 - your processes number limit is 15926
Tue May  9 02:46:31 2017 - your memory page size is 4096 bytes
Tue May  9 02:46:31 2017 - detected max file descriptor number: 1024
Tue May  9 02:46:31 2017 - lock engine: pthread robust mutexes
Tue May  9 02:46:31 2017 - thunder lock: disabled (you can enable it with --thunder-lock)
Tue May  9 02:46:31 2017 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/landingpage/socket fd 3
Tue May  9 02:46:31 2017 - uwsgi socket 1 bound to UNIX address /tmp/landingpage.sock fd 5
Tue May  9 02:46:31 2017 - Python version: 2.7.6 (default, Jun 22 2015, 18:01:27)  [GCC 4.8.2]
Tue May  9 02:46:31 2017 - Set PythonHome to /home/ubuntu/landingpage/venv/
Tue May  9 02:46:31 2017 - *** Python threads support is disabled. You can enable it with --enable-threads ***
Tue May  9 02:46:31 2017 - Python main interpreter initialized at 0x24f5fa0
Tue May  9 02:46:31 2017 - your server socket listen backlog is limited to 100 connections
Tue May  9 02:46:31 2017 - your mercy for graceful operations on workers is 60 seconds
Tue May  9 02:46:31 2017 - mapped 291168 bytes (284 KB) for 3 cores
Tue May  9 02:46:31 2017 - *** Operational MODE: preforking ***
ImportError: Import by filename is not supported.
Tue May  9 02:46:31 2017 - unable to load app 0 (mountpoint='') (callable not found or import error)
Tue May  9 02:46:31 2017 - *** no app loaded. going in full dynamic mode ***
Tue May  9 02:46:31 2017 - *** uWSGI is running in multiple interpreter mode ***
Tue May  9 02:46:31 2017 - spawned uWSGI master process (pid: 12729)
Tue May  9 02:46:31 2017 - spawned uWSGI worker 1 (pid: 12736, cores: 1)
Tue May  9 02:46:31 2017 - spawned uWSGI worker 2 (pid: 12737, cores: 1)
Tue May  9 02:46:31 2017 - spawned uWSGI worker 3 (pid: 12738, cores: 1)
这是mys-uWSGI配置文件:

[uwsgi]
project = landingpage
base = /home/ubuntu

chdir = %(base)/%(project)
home = %(base)/%(project)/venv/
module = %(base)/%(project).wsgi:application

logto=/var/log/uwsgi/%(project).log

master = true
processes = 3

socket = /tmp/%(project).sock
chmod-socket = 664
vacuum = true
我真的不知道我在这里遗漏了什么…

错误说明:

ImportError:不支持按文件名导入

这导致行
module=%(base)/%(project).wsgi:application
,其中使用unix文件路径表示法(
/
)而不是python文件路径表示法(
)来定位wsgi应用程序

尝试
module=%(项目)。wsgi:application

编辑:

此外,我还有一个问题,我的模块名不是我项目的目录名

我试过:

module=myrealmodulename.wsgi:application

成功了

错误显示:

ImportError:不支持按文件名导入

这导致行
module=%(base)/%(project).wsgi:application
,其中使用unix文件路径表示法(
/
)而不是python文件路径表示法(
)来定位wsgi应用程序

尝试
module=%(项目)。wsgi:application

编辑:

此外,我还有一个问题,我的模块名不是我项目的目录名

我试过:

module=myrealmodulename.wsgi:application


成功了

哪个python文件抛出了
ImportError
,它的导入是什么?这与uWSGI无关,而是与您的python代码有关。使用
manage.py runserver
运行您的项目,并尝试查明错误的位置。哪个python文件正在抛出
ImportError
及其导入内容?这与uWSGI无关,但与您的python代码有关。使用
manage.py runserver
运行项目,并尝试查明错误的位置。