Skip to main content

How to server static files in Django in development step by step.

1. Create 'static' folder  app/static/<appname>/<files>


















2.  update your urls.py in your project/urls as follows

from django.contrib import admin
from django.urls import path, include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = [
    path('', include('order.urls')),
    path('admin/', admin.site.urls),
]

urlpatterns += staticfiles_urlpatterns()

3. add the following line at the starting of any HTML temple page (base.html)

     {% load static %}












Comments

Popular posts from this blog

How to create PostgreSQL database in Linux.

My chat with ChatGPT #46315 I have file name "emotion_dataset_jira.sql" how to look into data available in it The file "emotion_dataset_jira.sql" appears to be a SQL file, which is a type of file that contains structured query language (SQL) commands. To view the data contained in this file, you will need to use a program or tool that can execute SQL commands. Some popular options include: MySQL: A free, open-source relational database management system that can be used to execute SQL commands and view data in a SQL file. phpMyAdmin: A free, open-source web-based tool that can be used to manage MySQL databases and execute SQL commands. SQLite: A small, embeddable, open-source SQL database engine that can be used to execute SQL commands and view data in a SQL file. You can use any of these tool to open the SQL file and look into the data. tell me step by step process with commands, I am using linux. I...

પોલીસ સ્ટેશનમાં

              હું રાહ જોઇ રહ્યો છું. હું રાહ જોતો બેઠો છું. ઝાડ નીચે બેઠો છું. પોલીસ સ્ટેશનમાં બેઠો છું. પોલીસ ઓફિસર ની રાહ જોતો બેઠો છું. સ્ટેશનની બહાર ઝાડ નીચે. પોણા છ વાગવા આવ્યા છે. રાહ જોવાઈ રહી છે ઓફિસર ની અમારા દ્વારા. અમારા છ મિત્રો દ્વારા. મન વિચારોના વંટોળે ચડ્યું છે - વ્યવસ્થા ના વિચારો , પોલીસના વિચારો , દેશના વિચારો , ભ્રષ્ટાચારના વિચારો , રાજનીતિના વિચારો , કેટલા બધા વિચારો .. વિચારો જ વિચારો . . ચિંતા વ્યવસ્થાની બધી , અમારી પણ. . .                                                      આજે સવારે જિંદગીમાં પહલી વાર પોલીસ સ્ટેશનમાં આવવાનું થયું. ફોન આવ્યો સવારે - " વિરાજભાઈ ક્યાં હોસ્ટેલમાં છો? " -- "હા , કેમ?? " --- " તો જરા નીચે આવજો ને આપણે પેલા દિવસે ડામોર સાહેબને હોસ્ટેલના પ્રૉબ્લેમ ની રજુઆત કરી હતી. હવે , સાહેબે પોલીસ ફરીયાદ કરી છે કે વિદ્યાર્થીઓ તેમને માનસિક દબાણ આપે છે અને આત્મહત્યા કરવા પ્રે...