django - 如何使用 django 和 apache 在文档根文件夹中提供图像
问题描述
我已经使用 apache 部署了一个 django 应用程序。我正在使用一个名为 django-ads 的应用程序,它允许我上传图像。该应用程序将图像转储到 BASE_DIR 文件夹中,因此当图像显示在 html 页面上时,图像 url 为http://ip-address/iphone.jpeg 。
以下是我的 conf 文件的外观:
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
WSGIScriptAlias / /var/www/html/mysite/wsgi.py
WSGIDaemonProcess advert-admin python-home=/home/joe/advert-admin/venv
python-path=/var/www/html
WSGIProcessGroup advert-admin
<Directory /var/www/html/>
AllowOverride all
Require all granted
Options FollowSymlinks
</Directory>
Alias /static/ /var/www/html/static/
<Directory /var/www/html/static>
Require all granted
</Directory>
每次加载图像时都会出现 404 错误。
如何使用 Apache 提供 /var/www/html 文件夹中的图像,以便http://ip-address/iphone.jpeg不返回 404?
解决方案
推荐阅读
- php - 内联 if 内联 if 的奇怪行为
- reactjs - 仅当 React Redux 应用程序中的数据库发生更改时才从数据库中刷新状态
- python-3.7 - 安装 Python 3.7 时出错 - E:子进程 /usr/bin/dpkg 返回错误代码 (1)
- javascript - 将值从 div 传递到文本框
- google-maps - 如何使用 gmap3 添加叠加层?
- python - 将多个值添加到 Json 字符串
- android - firebase 自定义事件显示(未设置)值
- javascript - 如何在 Node js 中散列下载流
- excel - 使用 vba 更改日期格式
- linux-kernel - /proc 文件系统中的线程组领导名称是什么?