1

Project Setup - Staticfiles

Get your Django app ready.

Then add the line of code below in your settings.py file.

STATIC_ROOT = BASE_DIR/'assets'

The code snippet above helps to create a folder called  "assets" this folder helps to hold your static files when your project goes live. 

 

Just before adding the "STATIC_ROOT" above you should already have these two lines configured by you.

STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR/"static"]

"STATIC_URL" comes together with Django while "STATICFILES_DIRS" is to be configured by you.

 

Then, to enable compression and caching support, add the code block just below "STATICFILES_DIRS".

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
1393
clintonmatics