【问题标题】:Deploying Django Project with apache2使用 apache2 部署 Django 项目
【发布时间】:2017-06-24 14:04:59
【问题描述】:

有人可以帮助我为什么它不起作用? (我的项目名称是ikh) 我正在使用 ubuntu 16.04 LTS、Apache2、Python3

ServerAdmin webmaster@localhost
DocumentRoot /var/www/ikh

WSGIDaemonProcess ikh python-path=/var/www/ikh/  python-home=/var/www/ikh/.env
WSGIProcessGroup ikh
WSGIScriptAlias / /var/www/ikh/ikh/wsgi.py

<Directory /var/www/ikh/ikh>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>



ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

【问题讨论】:

    标签: django python-3.x apache2 mod-wsgi wsgi


    【解决方案1】:

    我发现了一些有趣的问题:

    1 - 首先应该设置服务器来监听我想要部署的端口!

    Listen 8000
    

    2 - 使用 WSGIDaemonProcess 应该像我为我的 apache2 配置编写的这个示例一样

    WSGIDaemonProcess ikh python-path=/var/www/ikh  python-home=/var/www/ikh/env/lib/python3.5/site-packages
    

    仅此而已!

    【讨论】:

    • (2) 不正确,python-home 选项不应指向site-packages 目录。请参阅有关在 mod_wsgi 中使用虚拟环境的文档。 modwsgi.readthedocs.io/en/develop/user-guides/…
    • 您确认您使用的是虚拟环境的 Python 解释器中报告的 sys.prefix?它绝对不应该是python-homesite-packages 目录。这样做可能会导致 Python 解释器在启动时失败。
    猜你喜欢
    • 1970-01-01
    • 2020-07-26
    • 2016-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多