django - 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>
解决方案
推荐阅读
- python - 如何将输入参数传递给通过运行 python 文件访问的爬虫?
- python - 重命名多个文件,但只删除部分文件名
- angular - 将文本匹配到嵌套数组并返回 Id 值
- docker - Windows 上的多行 docker run 命令
- r - 等待 rgbif 下载完成后再继续
- .net-core - BeginExecuteNonQuery 需要一个打开且可用的连接。连接的当前状态为打开
- html - 如何使 3 个框显示在背景图像上方
- python - 使用 fast-ai 时如何修复“为 AWD_LSTM 加载 state_dict 时出错”
- c++ - 如果键小于第一个地图元素,为什么 unordered_map::equal_range upper_bound 返回 end
- c# - C#如何在字符串中写入特定的字符串?