Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django-Tables2 CSS不工作_Css_Django_Python 3.x_Django Haystack_Django Tables2 - Fatal编程技术网

Django-Tables2 CSS不工作

Django-Tables2 CSS不工作,css,django,python-3.x,django-haystack,django-tables2,Css,Django,Python 3.x,Django Haystack,Django Tables2,使用下面的代码,我无法让CSS处理tables2输出。我正在使用表2的开发版本以及Django 1.6、Haystack 2.1和Python 3.3 这是我的档案: table.py import django_tables2 as tables from bacterial.models import Quorum_Sensing class QuorumTable(tables.Table): class Meta: model = Quorum_Sensing

使用下面的代码,我无法让CSS处理tables2输出。我正在使用表2的开发版本以及Django 1.6、Haystack 2.1和Python 3.3

这是我的档案:

table.py

import django_tables2 as tables
from bacterial.models import Quorum_Sensing


class QuorumTable(tables.Table):
    class Meta:
        model = Quorum_Sensing
        attrs = {"class": "paleblue"}
report.html

{% load render_table from django_tables2 %}
<!doctype html>
<html>
 <head>
        <link rel="stylesheet"  href="{{ STATIC_URL }}django_tables2/themes/paleblue/css/screen.css" />

    </head>

{% block content %}
<body>
    <h2>Search</h2>

    <form method="get" action="../">
        <table>
            {{ form.as_table }}
            <tr>
                <td>&nbsp;</td>
                <td>
                    <input type="submit" value="Search">
                </td>
            </tr>

        </table>


 {% render_table table %}
        {% if  query %}

            <h3>Results</h3>


        {% else %}

{% endif %}


    </form>


{% endblock %}
 </body>
</html>

任何帮助或建议都将不胜感激。

您是否尝试运行“collect\u static”命令:
感谢您的所有反馈。事实证明,我的settings.py文件中没有以下代码:

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.request',)
对于遇到此问题的任何其他人,请确保您的设置文件中包含上述内容


再次感谢所有建议。

什么是“不工作”?浏览器是否正在加载css文件?在页面上尝试“查看源代码”,并检查样式表链接是否有效。如果没有,则文件可能位于错误的位置。由于设置文件更新修复了该问题,因此没有机会运行该命令。谢谢你的建议,如果我以后遇到类似的问题,我会参考这篇文章。
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.request',)