自從我開始使用Django框架時,我注意到當我進入管理站點和其他模板時,CSS樣式沒有出現,我認爲這是正常的,但隨着時間的推移,我已經看到我的合作伙伴的應用程序確實有風格,所以我將他們的項目複製到筆記本電腦上,然後運行它們,我可以看到它們應用程序的CSS樣式。 我從服務器上從數據庫獲取數據,這是我和我的合作伙伴的唯一區別。在我所有的Django應用程序中缺少CSS樣式
有誰知道我該如何解決這個問題?
PD:我使用Django的1.8版本和Python 3.4.4版本工作
這是我的我的HTML代碼庫
{% load staticfiles %}
<html>
<head>
<title>DENUE INEGI</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link href='//fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{% static 'css/crm.css' %}">
</head>
<body>
<div class="page-header">
{% if user.is_authenticated %}
{% else %}
<a href="{% url 'login' %}" class="top-menu"><span class="glyphicon glyphiconlock"></span></a>
{% endif %}
<h1><a href="/">Directorio Estadístico Nacional de Unidades Económicas INEGI</a></h1>
</div>
<div class="content container">
<div class="row">
<div class="col-md-8">
{% block content %}
{% endblock %}
</div>
</div>
</div>
</body>
</html>
這裏是我的setting.py文件
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR,'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
LOGIN_REDIRECT_URL = '/'
我很欣賞你的答案,謝謝:)
請包括你如何使用一些代碼/包含樣式表 – chrki
當然,您請稍等 –
沒有在您的文章的足夠信息。顯示設置文件您的項目。您也可以使用瀏覽器檢查網頁。並查看頁面上的錯誤。發佈所有這些信息,我們將盡力幫助您 –