我想使用wsgi部署django / wagtail应用程序。当我尝试在本地运行代码时,检查是否一切正常,它似乎正常工作-curl返回正确站点的html。
但是-当我运行uwsgi时(使用fuser -k 8054/tcp
之后):
uwsgi --http 127.0.0.1:8054 --chdir /home/ketohubp/KetoHub.pl --wsgi-file
/home/ketohubp/KetoHub.pl/Wagtail_Django_Static_Blog/wsgi.py --master --processes 1 --
workers 1 --threads 1 --daemonize=/home/ketohubp/KetoHub.pl/log.txt
然后称为curl:
(venv) ketohubp@hs7:~/KetoHub.pl$ curl localhost:8054
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8" />
<title>Internal server error</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
</head>
<body>
<h1>Internal server error</h1>
<h2>Sorry,there seems to be an error. Please try again soon.</h2>
</body>
</html>
显示错误。我尝试添加ALLOWED_HOSTS = ['*']
,但没有任何改变。
uwsgi.py:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE","Wagtail_Django_Static_Blog.settings.production")
application = get_wsgi_application()
虚拟主机:
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} python-home=/home/ketohubp/venv python-path=/home/ketohubp/KetoHub.pl
WSGIProcessGroup ketohub.pl
WSGIApplicationGroup %{GLOBAL}
<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>
评论是否要询问其他文件。