0

我有一个页面,由 apache 提供。当我通过 django 的服务器(在 localhost:8000 上)页面上传图像时,它确实正确地显示了上传的图像。但是,当我通过 apache 服务器(在 localhost 上)页面上传图像时,它不会显示上传的图像。只有当我在 django 的内置服务器(localhost:8000)上重新加载页面时,我才能在 apache 和 django 的服务器提供的页面上看到它。

这是 index.html:

{% load static from staticfiles %}
{% load thumbnail %}

<!DOCTYPE html>

<html>
    <head>
        <title>leo</title>
        <link rel="stylesheet" type="text/css" href="{% static "css/style.css" %}">
    </head>
....
....

这是图像的另一部分:

                        {% for Status in status %}
                            <p class="user">{{ Status.creator.get_full_name }}</p>
                            {% if Status.image %}
                                <div class="image_image">
                                    <center>
                                    <img src="{{Status.image |thumbnail_url:'status'}}"/>
                                    </center>
                                </div>
                                <p class="status_image">{{Status}}</p>
                                <span class="clear"></span>
                                <hr>
                            {% else %}
                                <p class="status_status">{{Status}}</p>
                                <span class="clear_right"></span>
                                <hr>
                            {% endif %}
                        {% endfor %}

在我从 html 文件中删除 EASY THUMBNAILS 标记并对 html 文件进行这些更改后,我没问题。

{% load static from staticfiles %}

<!DOCTYPE html>

<html>
....
....

和这个:

                            <div class="image_image">
                                <center>
                                <img src="{{ MEDIA_URL }}{{Status.image}}" width=300px />
                                </center>
                            </div>

为什么 apache 会这样?并且还在上传的目录中为同一图像创建了一个额外的图像。我想这是因为简单的缩略图会为图像创建一个新的缩略图。我在某个地方错了吗?是easy_thumbnails标签的问题???如果是。我如何使它工作。或者我怎样才能像简单的缩略图一样实现图像的缩略图?请指导我。谢谢!

4

0 回答 0