python - How to get css to work in Django -
for reason css file isn't doing anything, can me figure out why? think being sources properly, because when in source code generated when runserver , click on link css file text css file shows up. nothing css file being used
settings.py:
import os import sys base_dir = os.path.dirname(os.path.dirname(__file__)) dirname = os.path.dirname(__file__) sys.path.insert(0, os.path.join(base_dir, 'apps')) template_dirs = ( os.path.join(dirname, "templates") ) secret_key = _______ debug = true template_debug = true allowed_hosts = [] # application definition installed_apps = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'south', 'myapp', 'server', ) middleware_classes = ( 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', ) root_urlconf = 'server.urls' wsgi_application = 'server.wsgi.application' databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true static_url = '/static/' static_root = os.path.join(dirname, 'static') media_root = os.path.join(dirname, "media") media_url = '/media/'
urls.py:
from django.conf.urls import patterns, include, url django.views.static import * django.conf import settings server import views django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', views.index, name='home'), url(r'^admin/', include(admin.site.urls)), url(r'^about/', views.about, name='about'), url(r'^contact/', views.contact, name='contact'), url(r'^static/(?p<path>.*)$', 'django.views.static.serve', {'document_root':settings.static_root}), )
base.html:
{% load server_tags %} {% load staticfiles %} <!doctype html> <html lang="en"> <head> <title>{% block page_title %}{{ page_title }}{% endblock %}</title> <link href="{{ static_url }}server/stylesheet.css" rel="stylsheet" type="text/css" media="all"/> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> </head> <body> {% nav_bar user %} {% block content %} {% endblock %} </body> {% include "website/footer.html" %} </html>
stylesheet.css:
body { font-size: 20px; font-family: "helvetica neue", helvetica, arial, sans-serif; background-color: blue; text-align: right; }
change
rel="stylsheet"
to
rel="stylesheet"
Comments
Post a Comment