Template registration from Django Bootstrap

■ Environment

windows10  Pycharm Community 2019.3  Python3.7  Django3.03

■ Prerequisites

It is assumed that you are creating a Django project and application. See below Until Django application is created in the terminal

After creating the application, register below ![Application Registration] (https://qiita.com/oporimaster/items/4a8941760dca8765cda3)

■ What you can do

Use Bootstrap's free template with Django

■ Procedure

① Download Bootstrap template

https://startbootstrap.com/

Select a template from Thema and download it.

② Copy to the Django project.

  1. Create a static directory directly under your Django project

  2. Copy only "css", "image" and "vendor" there    image.png

Directory structure after copying image.png

③ Set the location of the static file.

As it is, Django can't figure out the location of the files under it, so Add the location to setting.py as follows.

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

BASE_DIR is defined in Setting.py with an absolute path as shown below.

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

that's all

Recommended Posts

Template registration from Django Bootstrap
Django # 2 (template)
Django Template notes
Django HTML template
Django template file organization
Django memo # 1 from scratch
DJango Note: From the beginning (creating a view from a template)
Django starting from scratch (part: 2)
Django starting from scratch (part: 1)
Use django model from interpreter
Show Django ManyToManyField in Template
DJango Memo: From the beginning (preparation)
[Beginner] Get from Django Query database
Get the value from the [Django] Form
Make a filter with a django template
How to pass values to JavaScript variables directly from the [Django] template tag