Django handles static files using the django.contrib.staticfiles app. This app collects static files from each of your applications and other locations, and places them in a single location that can easily be served in production.

For example, if you have an app called ‘myapp’ and you want to serve the static files from it, you would create a folder called ‘static’ in the root of the app. Then, you would add the following line to your settings.py:

STATICFILES_DIRS = [os.path.join(BASE_DIR, ‘myapp/static’)]

This tells Django to look in the ‘myapp/static’ folder for static files. Then, you can use the {% static %} template tag to reference the files in your templates. For example:

My App Logo

Leave a Reply

Your email address will not be published. Required fields are marked *