[英]Cannot deploy django app - ImportError: No module named django.core.wsgi
So basically, I want to deploy django (wagtail) application on hosting in my country.所以基本上,我想在我的国家/地区托管部署 django(wagtail)应用程序。 Here's what I have done:
这是我所做的:
source venv/bin/activate
).source venv/bin/activate
)。 uwsgi --http 127.0.0.1:8054 --chdir /home/ketohubp/KetoHub.pl --wsgi-file /home/ketohubp/KetoHub.pl/wsgi.py --master --processes 1 --workers 1 --threads 1 --daemonize=/home/ketohubp/KetoHub.pl/log.txt
(venv) ketohubp@hs7:~$ django-admin version 2.2.8
fuser -k 8054/tcp
fuser -k 8054/tcp
杀死并重新生成 uwsgi 进程 *** Starting uWSGI 2.0.18 (64bit) on [Mon Dec 9 17:37:19 2019] ***
compiled with version: 6.3.0 20170516 on 21 November 2019 19:38:29
os: Linux-4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19)
nodename: hs7.linux.pl
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/ketohubp/KetoHub.pl
detected binary path: /home/ketohubp/venv/bin/uwsgi
chdir() to /home/ketohubp/KetoHub.pl
your processes number limit is 256771
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 127.0.0.1:8054 fd 4
uwsgi socket 0 bound to TCP address 127.0.0.1:37743 (port auto-assigned) fd 3
Python version: 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]
Python main interpreter initialized at 0x55be3db1eb40
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145840 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
failed to open python file /home/ketohubp/KetoHub.pl/wsgi.py
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 master process (pid: 16988)
spawned uWSGI worker 1 (pid: 16989, cores: 1)
spawned uWSGI http 1 (pid: 16990)
[Wed Dec 04 20:53:06.200086 2019] [wsgi:error] [pid 4914:tid 140320264152832] [remote 193.239.126.103:49538] mod_wsgi (pid=4914): Failed to exec Python script file '/home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/wsgi.py'.
[Wed Dec 04 20:53:06.200171 2019] [wsgi:error] [pid 4914:tid 140320264152832] [remote 193.239.126.103:49538] mod_wsgi (pid=4914): Exception occurred processing WSGI script '/home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/wsgi.py'.
[Wed Dec 04 20:53:06.200187 2019] [wsgi:error] [pid 4914:tid 140320264152832] [remote 193.239.126.103:49538] Traceback (most recent call last):
[Wed Dec 04 20:53:06.200196 2019] [wsgi:error] [pid 4914:tid 140320264152832] [remote 193.239.126.103:49538] File "/home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/wsgi.py", line 12, in <module>
[Wed Dec 04 20:53:06.200222 2019] [wsgi:error] [pid 4914:tid 140320264152832] [remote 193.239.126.103:49538] from django.core.wsgi import get_wsgi_application
[Wed Dec 04 20:53:06.200231 2019] [wsgi:error] [pid 4914:tid 140320264152832] [remote 193.239.126.103:49538] ImportError: No module named django.core.wsgi
DocumentRoot /home/ketohubp/KetoHub.pl
WSGIScriptAlias / /home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/wsgi.py
WSGIDaemonProcess ketohub.pl processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup ketohub.pl
<directory /home/ketohubp/KetoHub.pl>
SetHandler wsgi-script
AllowOverride all
Require all granted
Options ExecCGI FollowSymlinks
<Files wsgi.py>
Require all granted
</Files>
</directory>
Alias /static/ /home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/static/
<Directory /home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/static>
Require all granted
</Directory>
我明白了,问题是“--wsgi-file /home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/wsgi.py”不正确的路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.