Template and static folder settings in python django

You Tube Video For How To Create Static Folder and Template Folder.

Project Folders Structure

Template Folder

HTML files are kept in the template folder. Whatever new HTML files will be in the project, which we will create, we will keep all the files inside the template folder.

After creating the template folder in python django, we also have to do many settings, whose code you will find below

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

Static Folder

Static folders keep things like JavaScript, CSS, images, and Fontaewsome. We also have to do some setting in python django to access the things kept inside static folder.

All the code for the static folder's settings will be provided to you below.


STATIC_URL = '/static/'
STATIC_ROOT = '/static/'

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

Tags

#pythonlife #pythonprojects #pythonlanguage #pythonsnake #pythontutorial #pythonbaba #pythoninhindi #python3 #pythonbasics #pythoncourse #pythonclass11cbse #pythonclassattenkasi #pythoncode #pythoncoding #pythonchatbot #pythoncowboy #pythondash #pythondatasciencetutorial #pythondjango #pythonedureka #pythonessentials #pythonfrieght #pythonforbegginers #pythonforbeginners #pythonfordatascience #pythonfullcourse #pythonfullstackdevelopercourseinbangalore #pythonfullstackdevelopercourseinhyderabad #pythonfundamentals #pythongui #pythongraphics #pythonguitutorial #pythonhunting #pythonintelugu #pythonimageprocessing #pythonintree #pythoninterview #pythoninonevideo #pythoninterviewquestions #pythonintro #pythonjarvis #pythonkannada #pythonloginsystem #pythonlogintkinter #pythonlanguagefordsssbexam #pythonmockinterview #pythonmachinelearning #pythonmcq #pythonmalayalam #pythononlinetraining #pythonprojectusingsqlconnectivity #pythonprogrammingforbeginners #pythonprogrammingfullcourse #pythonprojectideas #pythonprogramming #pythonprograms #pythonprogramsintamil #pythonregex #pythonrevisiontour #pythonrightnow

Post a Comment

Previous Post Next Post

Contact Form