cannot loading custom CSS in Django ontop of Bootstrap -
i able load static images, however; when comes loading custom css sheets cannot seem working.
because static images loading, believe settings.py set properly, however, wrong.
my static files css , images located within /static/img/hive.png , /static/css/main.css respectively.
any appreciated!
settings.py
import os base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) allowed_hosts = [] debug = true installed_apps = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] middleware = [ 'django.middleware.security.securitymiddleware', '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 = 'ideas.urls' templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [], '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', ], }, }, ] wsgi_application = 'ideas.wsgi.application' databases = { 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } auth_password_validators = [ { 'name': 'django.contrib.auth.password_validation.userattributesimilarityvalidator', }, { 'name': 'django.contrib.auth.password_validation.minimumlengthvalidator', }, { 'name': 'django.contrib.auth.password_validation.commonpasswordvalidator', }, { 'name': 'django.contrib.auth.password_validation.numericpasswordvalidator', }, ] language_code = 'en-us' time_zone = 'utc' use_i18n = true use_l10n = true use_tz = true static_url = '/static/'
home.html
{% load static %} <!doctype html> <html lang="en"> <head> <!-- required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- bootstrap css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoiresju2yc3z8gv/npezwav56rsmlldc3r/azzgrngxqqknkkofvhfqhnuweyj" crossorigin="anonymous"> <!-- personal css --> <link rel="stylesheet" href="{% static "css/main.css" %}"> </head> <body> <img src="{% static "img/hive.png" %}" alt="my image"/> <!-- jquery first, tether, bootstrap js. --> <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-a7fzj7v+d/sdmmqp/noqwlilvusjfdhw+k9omg/a/eheadgtzns3hpfag6ed950n" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-dztdapbwprxsa/3eyeeuwrwcy7g5kfbe8ffjk5jaixuyhkkdx6qin1dkwx51bbrb" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vbwwzlzj8ea9acx4pew3rvhjgjt7zpknpzk+02d9phzyevke+jo0iegizqplforn" crossorigin="anonymous"></script> </body> </html>
had run 'python manage.py collectstatic' static files update.
Comments
Post a Comment