Django apache wsgi问题

2024-10-01 09:34:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我想要使用apache和mod_wsgi打开django服务器。 我写了如下

sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi

创建django项目和应用程序,然后添加我的bot设置.py 创建虚拟环境并使用 并在seoultech中添加以下代码/wsgi.py/django=mydirectory/seoultech=project/bot=app/

^{pr2}$

和cd/etc/apache2/site available/000-默认.conf 添加代码

^{3}$

但是sudo apachectl-k启动时出错了

'AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled
/000default.conf:Invalid command 'WSGIDaemonProcess', perhaps misspelled
or defined by a module not included in the server configuration Action '-k
start' failed.The Apache error log may have more information.'

我期待着帮助你


Tags: installdjango代码pymodwsgigetconf
1条回答
网友
1楼 · 发布于 2024-10-01 09:34:11

将WSGIDaemonProcess放在VirtualHost内部以消除此错误。在

<VirtualHost *:80>

    ServerAdmin webmaster@localhost

    WSGIDaemonProcess seoultech python-path=/home/django/seoultech=home/django
/venv/lib/python2.7/site-packages
    WSGIScriptAlias / /home/django/seoultech/wsgi.py


<Directory /home/django/seoultech>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory
</VirtualHost>

相关问题 更多 >