Python/Django Development 5 of 12 - Using Templates and Static media in Django project

Опубликовано: 16 Октябрь 2024
на канале: JW
1,689
12

(1) Get my baseline project from GitHub:
https://github.com/playdoh888/youtube5

(2) Read the README file comes with the "youtube5" repository. Follow the steps stated in the README.

(3) Link to Tango with Django Class Book:
http://www.tangowithdjango.com/book17...

(4) Tell Django where your "Templates" directory are (in settings.py):
TEMPLATE_PATH = os.path.join(BASE_DIR, 'templates')
TEMPLATE_DIRS = (
Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
Always use forward slashes, even on Windows.
Don't forget to use absolute paths, not relative paths.
TEMPLATE_PATH,
)

(5) Tell Django where is your "Static" directory are:
STATIC_PATH = os.path.join(BASE_DIR,'static')

STATIC_URL = '/static/' # You may find this is already defined as such.

STATICFILES_DIRS = (
STATIC_PATH,
)