본문 바로가기

Django Static 본문

개발/Django

Django Static

Louisus 2020. 5. 4. 23:47
728x90

1. Create static folder

 

2. static/images, css folder

 

3. Project Folder/settings.py

 

STATIC_DIR = os.path.join(BASE_DIR, 'static')

 

STATIC_DIRS = [

    STATIC_DIR,

]

 

4. templates/html file

 

{% load static %}

<head>

    <link ... href="{% static "css/css file" %}"

</head>

<body>

    <img src='{% static "images/image file" %}" alt = "Error" />

</body>

 

 

'개발 > Django' 카테고리의 다른 글

Population Scripts  (0) 2020.05.05
Models  (0) 2020.05.05
Django Templates  (0) 2020.05.04
Django URL Mappings  (0) 2020.05.04
TemplateDoesNotExist  (0) 2020.05.04
Comments