首页 > 解决方案 > Apache错误:将python日志写入项目目录外的文件时

问题描述

我正在开发一个 Django 项目并使用 Apache 作为 Web 服务器。一切正常

python manage.py runserver

但是在通过 apache 运行应用程序时,我无法将我的 python 应用程序日志写入项目目录之外的指定路径。

项目目录/home/ubuntu/saas-DocumentProcessing

日志文件在

/home/ubuntu/log/SaasAap/SaasAap.log/home/ubuntu/log/error/error.log

我的000-default.conf内容

<VirtualHost *:8000>
        ServerAdmin abc@xyz.com
        ServerName my_ip
        ServerAlias my_ip
        DocumentRoot /home/ubuntu/saas-DocumentProcessing/
        WSGIScriptAlias / /home/ubuntu/saas-DocumentProcessing/src/wsgi.py
        Alias /static/ /home/ubuntu/saas-DocumentProcessing/static/
        ErrorLog /home/ubuntu/log/error.log
        CustomLog /home/ubuntu/log/custom.log combined
        <Location "/static/">
                Options -Indexes
                        AllowOverride All
                        Require all granted
        </Location>
        <Location "/">
                AllowOverride All
                Require all granted
        </Location>
        <Directory /home/ubuntu/saas-DocumentProcessing/static>
                Order allow,deny
                 Allow from all
        </Directory>
         <Directory /home/ubuntu/log>
                Order allow,deny
                 Allow from all
        </Directory>
        WSGIDaemonProcess saas-DocumentProcessing python-path=/home/ubuntu/
saas-DocumentProcessing python-home=/home/ubuntu/saas-DocumentProcessing/ve
nv
        WSGIProcessGroup saas-DocumentProcessing

</VirtualHost>

标签: djangoapacheamazon-web-servicesapache2.4

解决方案


推荐阅读