DEV Community

Ritik Soni
Ritik Soni

Posted on

Learn About Django `StaticFiles`.

definition of static_url, static_root, STATICFILES_DIRS.

static_url :

  • it does nothing other then prepending onto your static file url

static_root :

  • it is the root folder path where our static file will be saved after running collectstatic management command. it has nothing to do in our development server because runserver helps us to serve our static files easily. but in Production server you wont be running runserver. so thats where static_root comes into picture. if you are using any reverse proxy like nginx or apache then these proxy server needs some static root paths to serve static files.

STATICFILES_DIRS :

  • It can be a tupel or a list of extra-static-paths where you have placed some static-files for your project/app.
    • extra-static-paths : your static file folder other then folder named static

Top comments (0)