简体   繁体   English

Centos7上的Wigtail部署

[英]Wagtail deployment on Centos7

I could really use some help here. 我真的可以在这里使用一些帮助。 I am in the process of setting up a test deployment of wagtail on a CentOS7 box and it seems as though the wsgi daemon is not getting access to the necessary python modules. 我正在CentOS7盒子上设置wagtail的测试部署,好像wsgi守护进程无法访问必要的python模块。 I have checked permissions on all of the directories in the virtual environment and made sure that the owner was apache as well as the group owner was apache (recursively). 我检查了虚拟环境中所有目录的权限,并确保所有者是apache以及组所有者是apache(递归)。 SELinux is also in permissive mode while I'm trying to figure this out. SELinux也处于宽容模式,而我正试图解决这个问题。 It's a fresh install of wagtail, no modifications have been made after running the start command from wagtail. 这是wangtail的全新安装,从wagtail运行start命令后没有进行任何修改。

My virtual host config file is as follows: 我的虚拟主机配置文件如下:

<VirtualHost *:80>
ServerName <server.name>
ServerAdmin <server.admin>
Alias /static /var/www/<virtual.env>/<project.name>/static
<Directory /var/www/<virtual.env>/<project.name>/static>
    Require all granted
</Directory>
<Directory /var/www/<virtual.env>/<project.name>/wsgi.py>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>
WSGIDaemonProcess <project> python-path=/var/www/<virtual.env>/<project.name>/<project.name>:/var/www/<virtual.env/lib/python3.4/site-packages
WSGIProcessGroup <project>
WSGIScriptAlias / /var/www/<project.env>/<project.name>/<project.name>/wsgi.py

ErrorLog /var/log/httpd/<project.name>_error.log
CustomLog /var/log/httpd/<project.name>_access.log combined

My project_error.log file contains the following: 我的project_error.log文件包含以下内容:

[Thu May 04 18:50:35.596691 2017] [:error] [pid 13101] [remote 10.30.112.49:52] mod_wsgi (pid=13101): Exception occurred processing WSGI script '/var/www/<project.name>_env/<project.name>/<project.name>/wsgi.py'.
[Thu May 04 18:50:35.596712 2017] [:error] [pid 13101] [remote 10.30.112.49:52] Traceback (most recent call last):
[Thu May 04 18:50:35.596733 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/<project.name>/<project.name>/wsgi.py", line 18, in <module>
[Thu May 04 18:50:35.596785 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     application = get_wsgi_application()
[Thu May 04 18:50:35.596797 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu May 04 18:50:35.596836 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     django.setup(set_prefix=False)
[Thu May 04 18:50:35.596846 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/django/__init__.py", line 27, in setup
[Thu May 04 18:50:35.596887 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     apps.populate(settings.INSTALLED_APPS)
[Thu May 04 18:50:35.596898 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
[Thu May 04 18:50:35.597029 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     app_config.import_models(all_models)
[Thu May 04 18:50:35.597039 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/django/apps/config.py", line 199, in import_models
[Thu May 04 18:50:35.597118 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     self.models_module = import_module(models_module_name)
[Thu May 04 18:50:35.597131 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
[Thu May 04 18:50:35.597177 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     __import__(name)
[Thu May 04 18:50:35.597187 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/wagtail/wagtailforms/models.py", line 16, in <module>
[Thu May 04 18:50:35.597283 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     from wagtail.wagtailadmin.edit_handlers import FieldPanel
[Thu May 04 18:50:35.597292 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 19, in <module>
[Thu May 04 18:50:35.597493 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     from wagtail.wagtailadmin import compare, widgets
[Thu May 04 18:50:35.597503 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/wagtail/wagtailadmin/compare.py", line 5, in <module>
[Thu May 04 18:50:35.597660 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     from bs4 import BeautifulSoup
[Thu May 04 18:50:35.597673 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/bs4/__init__.py", line 35, in <module>
[Thu May 04 18:50:35.597822 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     from .builder import builder_registry, ParserRejectedMarkup
[Thu May 04 18:50:35.597832 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/bs4/builder/__init__.py", line 7, in <module>
[Thu May 04 18:50:35.597933 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     from bs4.element import (
[Thu May 04 18:50:35.597943 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/bs4/element.py", line 10, in <module>
[Thu May 04 18:50:35.598337 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     from bs4.dammit import EntitySubstitution
[Thu May 04 18:50:35.598347 2017] [:error] [pid 13101] [remote 10.30.112.49:52]   File "/var/www/<project.name>_env/lib/python3.4/site-packages/bs4/dammit.py", line 14, in <module>
[Thu May 04 18:50:35.598548 2017] [:error] [pid 13101] [remote 10.30.112.49:52]     from html.entities import codepoint2name
[Thu May 04 18:50:35.598565 2017] [:error] [pid 13101] [remote 10.30.112.49:52] ImportError: No module named html.entities

Huge thanks in advance. 非常感谢提前。

Two things I noticed. 我发现了两件事。 <Directory /var/www/<virtual.env>/<project.name>/wsgi.py> should point to the directory <Directory /var/www/<virtual.env>/<project.name>/ , not the file itself. <Directory /var/www/<virtual.env>/<project.name>/wsgi.py>应指向目录<Directory /var/www/<virtual.env>/<project.name>/ ,而不是文件本身。 Also, mod_wsgi needs to be compiled against the same version of Python you developed against, as @gasman mentioned. 另外, mod_wsgi需要针对您开发的相同版本的Python进行编译,正如@gasman所提到的那样。

If you want to upgrade to Python 3.5 and install mod_wsgi from the IUS repository: 如果要升级到Python 3.5并从IUS存储库安装mod_wsgi

sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
sudo yum install python35u python35u-pip python35u-devel python35u-mod_wsgi

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM