Skip to content

Commit

Permalink
Added support for including our own css files
Browse files Browse the repository at this point in the history
  • Loading branch information
shreys7 committed Dec 2, 2019
1 parent 55fb942 commit 90cb914
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions todoApp/staticfiles/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.page-header {
width: 50%;
margin: 0 auto;
}
8 changes: 8 additions & 0 deletions todoApp/todoApp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,12 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/static/'

STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'staticfiles'),
)
6 changes: 5 additions & 1 deletion todoApp/todoApp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
"""
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from . import settings

urlpatterns = [
path('todos/', include('todos.urls')),
path('admin/', admin.site.urls),
]
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()
4 changes: 4 additions & 0 deletions todoApp/todos/templates/todos/base.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% load static %}
<!doctype html>
<html lang="en">
<head>
Expand All @@ -7,6 +8,9 @@

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<!--- Our CSS file -->
<link rel="stylesheet" href="{% static 'css/style.css' %}">

{% block title %}
{% endblock %}
</head>
Expand Down

0 comments on commit 90cb914

Please sign in to comment.