uwsgi + django + nginx:Python应用程序未加载

时间:2017-08-11 17:50:44

标签: python django nginx uwsgi

在一堆教程之后,我编写了我的第一个django应用程序,然后决定将它部署在linode服务器上。在their tutorial之后,我才到目前为止。我能说的最好,这是基于早期版本的Ubunto,我尝试了其他一些东西,包括uwsgi快速入门教程。

我已经足够了,命令'python manage.py runserver'将提供给我的网站,并希望继续使用uwsgi来做同样的事情。

似乎缺少一些环境变量。当我尝试从命令行启动uwsgi:

uwsgi --http :8000 --module dynamicefl.wsgi

我得到以下内容:

*** Starting uWSGI 2.0.15 (64bit) on [Fri Aug 11 19:37:04 2017] ***
compiled with version: 6.3.0 20170406 on 10 August 2017 23:41:13
os: Linux-4.9.36-x86_64-linode85 #1 SMP Thu Jul 6 15:31:23 UTC 2017
nodename: roosevelt
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/django/worksheets/dynamic-efl
detected binary path: /usr/local/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 3941
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8000 fd 4
spawned uWSGI http 1 (pid: 5998)
uwsgi socket 0 bound to TCP address 127.0.0.1:43637 (port auto-assigned) fd 3
Python version: 2.7.13 (default, Jan 19 2017, 14:48:08)  [GCC 6.3.0 20170118]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x562bdad6fda0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72760 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
Traceback (most recent call last):
  File "./dynamicefl/wsgi.py", line 12, in <module>
    from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi
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: 5997, cores: 1)

很多教程都强调在.ini文件中放置虚拟环境的路径,我做了(用'env'仔细检查我的虚拟环境是否正确。)这是.ini文件我是使用

[uwsgi]
home = /home/django/Env/worksheets
chdir = /home/django/worksheets/dynamic-efl/dynamicefl
module = dynamicefl.wsgi::application

uid = www-data
gid = www-data
socket = localhost:9191
chmod-socket = 644
chown-socket = www-data

processes = 4
threads = 2
logto = /var/log/uwsgi.log

我已经尝试过更改一些chdir命令,因为我不确定它应该指向的确切位置,但不知道它指向哪里导致uwsgi.log中的类似行:

 -- no python application found, check your startup logs for errors ---

(有趣的是:我无法找到对uwsgi启动日志的引用)

如果我在网络浏览器中访问该网站,则会收到“内部服务器错误”消息。

我认为没有任何东西可以获得nginx,但我也可以包含.conf文件和错误日志,如果这有用的话。

我知道有类似问题的日志,但我看了他们,他们没有帮助我。 (这并不是说他们没有答案。)

0 个答案:

没有答案