apache 如何为没有虚拟环境的fjango配置wgsi配置文件?

disho6za  于 2023-01-05  发布在  Apache
关注(0)|答案(1)|浏览(134)

我想主机django应用程序使用apache2与mod_wsgi没有虚拟环境,所以我不能配置.conf文件这里是我的配置文件。

<VirtualHost *:80>
ServerName example.in
ServerAdmin info@example.in
ServerAlias example.in
DocumentRoot /home/MyMedbookMain/django

Alias /static /home/MyMedbookMain/django/static
<Directory /home/TransportDemo/static>
     Require all granted
</Directory>

<Directory /home/MyMedbookMain/django/qm>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess mymedbook python-home=/usr/local/bin/pip3 python-path=/home/MyMedbookMain/django
WSGIProcessGroup mymedbook
WSGIScriptAlias / /home/MyMedbookMain/django/qm/wsgi.py

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

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

重新加载apache2后,未加载

gajydyqb

gajydyqb1#

嗨,你能告诉我你得到了什么错误吗?我建议使用虚拟环境,因为它会给予你更好地了解你的要求,如果你需要它是如何使用虚拟环境下面是答案

<VirtualHost *:80>
 
ServerName example.in

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

Alias /static  /var/www/backend-2022-aprl/staticfiles

<Directory /var/www/backend-2022-aprl/staticfiles>
    Require all granted
</Directory>

Alias /media  /var/www/backend-2022-aprl/media
<Directory /var/www/backend-2022-aprl/media >
    Require all granted
</Directory>

<Directory /var/www/backend-2022-aprl/mywill>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess my_will3 python-path=/var/www/backend-2022-aprl python-home=/var/www/env

WSGIProcessGroup my_will3
WSGIScriptAlias / /var/www/backend-2022-aprl/mywill/wsgi.py
WSGIPassAuthorization On

请分享你从apache得到的错误.

相关问题