Py学习  »  问与答

django 部署 Internal Server Error

HicK • 7 年前 • 3045 次点击  

环境使用centos6.5 + django1.10.3+nginx+uwsgi nginx.conf

server {

        listen   80;
        server_name 127.0.0.1
    #access_log /data/www/wiki/logs/access.log;
        #error_log /data/www/wiki/logs/error.log;

    #charset     UTF-8;
        #access_log  logs/host.access.log  main;

        location / {
            uwsgi_pass     127.0.0.1:8001;
                    include        uwsgi_params;
                    uwsgi_param UWSGI_SCRIPT wsgi;
                    uwsgi_param UWSGI_CHDIR /data/www/wiki/;
        }

        #error_page  404              /404.html;

        location /static/ {
            alias  /data/www/wiki/static/;
            index  index.html index.htm;
        }

        location /papers/ {
            alias  /data/www/wiki/papers/;
        }
    }

wsgi.py文件放在项目的路径下 uwsgi.ini配置为

[uwsgi]
socket = 127.0.0.1:8001
home = /data/www/test
chdir = /data/www/wiki
wsgi-file = wiki/wsgi.py
master = true        
vhost = true          
no-site = true        
workers = 2          
reload-mercy = 10     
vacuum = true        
max-requests = 1000   
limit-as = 512
buffer-size = 30000

运行uwsgi --ini uwsgi.ini

Set PythonHome to /data/www/test
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x2396ef0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 296016 bytes (289 KB) for 2 cores
*** Operational MODE: preforking ***
Traceback (most recent call last):
  File "wiki/wsgi.py", line 13, 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 ***

为什么会提示这个模块找不到呢? 我是使用pip安装uwsgj的

最后一次修改于 (2016-11-29 15:15)
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1724
 
3045 次点击  
文章 [ 1 ]  |  最新文章 7 年前
HicK
Reply   •   1 楼
HicK    7 年前

我在虚拟环境中测试可以导入模块

>>> from django.core.wsgi import get_wsgi_application
>>>