The Django project reports errors after publishing using nginx and uwsigi

after entering the domain name for access, the browser displays an internal server error. In addition, I checked the log and got the following error message. Who can give me some suggestions? Thank you

Thu Sep  6 18:02:36 2018 - unable to load app 0 (mountpoint="") (callable not found or import error)
Thu Sep  6 18:02:36 2018 - --- no python application found, check your startup logs for errors ---
{address space usage: 180469760 bytes/172MB} {rss usage: 6373376 bytes/6MB} [pid: 9609|app: -1|req: -1/7] 10.8.0.7 () {48 vars in 827 bytes} [Thu Sep  6 18:02:36 2018] GET /favicon.ico => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

my django project directory structure:

[root@openvpn conf]-sharp ll /var/www/EWP_OMS
total 56
drwxr-xr-x 2 www www 4096 Sep  6 15:24 AUTH
drwxr-xr-x 3 www www 4096 Sep  6 15:24 CMDB
drwxr-xr-x 3 www www 4096 Sep  6 11:43 COBBER
drwxr-xr-x 2 www www 4096 Sep  6 18:01 EWP_OMS
-rw-r--r-- 1 www www  250 Jul 22  2016 manage.py
drwxr-xr-x 4 www www 4096 Sep  4 15:28 media
drwxr-xr-x 4 www www 4096 Sep  6 15:24 pagination
-rw-r--r-- 1 www www 7603 Jul 22  2016 README.md
-rw-r--r-- 1 www www   34 Sep  4 17:49 requirements.txt
drwxr-xr-x 3 www www 4096 Sep  6 15:25 SALT
drwxr-xr-x 6 www www 4096 Sep  4 15:28 static
drwxr-xr-x 6 www www 4096 Sep  4 15:28 templates
drwxr-xr-x 3 www www 4096 Sep  6 15:25 ZABBIX

[root@openvpn conf]-sharp  ls /var/www/EWP_OMS/EWP_OMS/
config.ini  __init__.py  __init__.pyc  settings.py  settings.pyc  urls.py  urls.pyc  wsgi.py  wsgi.pyc

wsgi.py:

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "EWP_OMS.settings")

application = get_wsgi_application()

uwsgi.ini:

[uwsgi]
uid = www
gid = www
socket = 0.0.0.0:9000
master = true
pidfile = /usr/local/nginx-1.6.3/uwsgi.pid
processes = 8
chdir = /var/www/EWP_OMS/
pythonpath = /var/www/EWP_OMS_ENV
profiler = true
memory-report = true
enable-threads = true
logdate = true
limit-as = 6048
daemonize = /var/log/nginx/django.log

/ var/www/EWP_OMS_ENV is my virtualenv environment directory,

I use this command to execute uwsgi:

uwsgi-- ini / usr/local/nginx/conf/uwsgi.ini

Nginx configuration:

server {
    listen 80;
    server_name oms.ewp.com;
    location / {
        uwsgi_pass 127.0.0.1:9000;
        include uwsgi_params;
        uwsgi_param UWSGI_CHDIR /var/www/EWP_OMS;
        uwsgi_param UWSGI_SCRIPT EWP_OMS;
        access_log /var/log/nginx/ewp_oms.access.log;
    }
    location ~* ^.+\.(mpg|avi|mp3|swf|zip|tgz|gz|rar|bz2|doc|xls|xe|ppt|txt|tar|mid|midi|wav|rtf|mpeg)$ {
        root /var/www/EWP_OMS/static;
        access_log off;
    }
}
Jun.01,2021

solve it yourself, add

module=EWP_OMS.wsgi:application

or

wsgi-file = EWP_OMS/wsgi.py

in addition, put

pythonpath = / var/ EWP_OMS_ENV
Change

to

virtualenv=/var/ EWP_OMS_ENV

is fine

in addition, nginx can be set to

upstream oms {
        ip_hash;
        server 127.0.0.1:9000;
}
server {
    listen 80;
    server_name oms.ewp.com;
    location / {
        uwsgi_pass oms;
        include uwsgi_params;
        access_log /var/log/nginx/ewp_oms.access.log;
    }
    location /media  {
        alias /var/www/EWP_OMS/media;
    }
    location /static {
        alias /var/www/EWP_OMS/static;
}
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b9d7-2ba9d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b9d7-2ba9d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?