Variable Routing & DTL

Django - The web framework for perfectionists with deadlines

Folder structure

1. Package folder

settings.py

Allowed hosts

ALLOWED_HOSTS = ['*']
  • '*' ์€ ๋ชจ๋“  ๊ฒƒ์„ ์˜๋ฏธํ•˜๋Š” wildcard

Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'pages', #app register
]
  • ์ƒˆ๋กœ์šด app์„ ๋งŒ๋“ค ๋•Œ๋งˆ๋‹ค ์ถ”๊ฐ€ํ•ด์ค˜์•ผํ•จ

Language setting & Internalization

manage.py

  • ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ํŒŒ์ผ

  • ์ˆ˜์ •ํ•˜์ง€ ๋ง๊ฒƒ!

2. Apps folder

  • apps.py

    : app ์„ค์ •

  • admin.py

    : ๊ด€๋ฆฌ์ž view

  • models.py

    : model

  • tests.py

    : ํ…Œ์ŠคํŠธ

Variable routing

url์˜ ํŠน์ • ์œ„์น˜์˜ ๊ฐ’์„ ๋ณ€์ˆ˜๋กœ ํ™œ์šฉ

1. urls.py

2. views.py

3. template

DTL (Django Template Language)

Template file (HTML) ์€ django template language๋ฅผ ํ†ตํ•ด ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค!

  • Djangoโ€™s template language is designed to strike a balance between power and ease.

  • Itโ€™s designed to feel comfortable to those used to working with HTML.

๊ธฐ๋ณธ ๋ฌธ๋ฒ•

1. ์ถœ๋ ฅ {{ }}

2. ๋ฌธ๋ฒ• {% %}

Last updated

Was this helpful?