Html CSS规则没有得到应用
由于某些原因,我的CSS规则没有被应用。我知道css页面正在被找到并加载到浏览器中。只是规则没有被应用。我尝试过只执行h1规则,但我的规则没有应用到页面。我在ubuntu 12.04服务器上使用uwsgii和nginx。我已经收集了我的静态、重新启动的uwsgi和nginx,我已经更改了规则,我已经添加了!重要的是,我错过了一些东西,我不知道是什么。任何帮助都将不胜感激 目前,我的css/base.css看起来是这样的-我也尝试过将颜色改为红色,但不是TAHtml CSS规则没有得到应用,html,css,django,nginx,Html,Css,Django,Nginx,由于某些原因,我的CSS规则没有被应用。我知道css页面正在被找到并加载到浏览器中。只是规则没有被应用。我尝试过只执行h1规则,但我的规则没有应用到页面。我在ubuntu 12.04服务器上使用uwsgii和nginx。我已经收集了我的静态、重新启动的uwsgi和nginx,我已经更改了规则,我已经添加了!重要的是,我错过了一些东西,我不知道是什么。任何帮助都将不胜感激 目前,我的css/base.css看起来是这样的-我也尝试过将颜色改为红色,但不是TA .evil { color:
.evil {
color: #c5e3bf;
}
我的基本模板-如下所示:
<!DOCTYPE html>
<html>
<head>
<title>{% block sub_title %}{% endblock %} Awesome title</title>
{% load staticfiles %}
<link rel="stylesheet/css" type="text/css" href='{% static "css/base.css" %}'>
<script type="text/javascript" src="{% static 'jquery-2.1.0.js' %}"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.js"></script>
<script type="text/javascript" src="{% static 'Underscore.js' %}"></script>
<script type="text/javascript" src="{% static 'Restangular.js' %}"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-route.js"></script>
<script src="{% static 'js/ng-sign-in/app.js' %}"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<body>
<span class="evil">Punch something, you know you wanna. Just do it.</span>
</body>
</html>
我的网址:
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
from django.conf import settings
from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls),
url(r'^$', HomeView.as_view(), name='home'),
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) # this was added in per request -- notta.
尝试在URL.py中添加+staticsettings.STATIC\u URL,document\u root=settings.STATIC\u root: urlpatterns=patterns,您的URL+staticsettings.STATIC\u URL,document\u root=settings.STATIC\u root
在所有使用AngularJS的元素之后,您包含了AngularJS,请尝试将AngularJS放在元素的顶部。尝试后仍然失败。然后试着把这种风格放在头上。邪恶{color:red}作为初步测试。你有高水平的东西在这里发生。。。让我们回到最基本的一秒钟…@sheriffderek-这很有效。这就是问题所在!是 啊所以你知道你的路线是关闭的。。。呃你的{%}东西。。。那是什么?有棱角的东西?如果你是在那些花哨的占位符之后加载angular。。。它如何知道它是什么?我的理解是,只有在使用./manage.py runserver在本地运行服务器时,才应该在开发中应用这一点。当您使用nginx+uwsigi时,您不需要它吗?这不对吗?
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic import TemplateView
from django.conf import settings
from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls),
url(r'^$', HomeView.as_view(), name='home'),
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) # this was added in per request -- notta.