# STATIC\_ROOT vs STATICFILES\_DIRS

**URL:** <https://forum.djangoproject.com/t/static-root-vs-staticfiles-dirs/5241>\
**Category:** Getting Started\
**Created:** [November 17, 2020, 1:51pm UTC](https://forum.djangoproject.com/t/static-root-vs-staticfiles-dirs/5241 "2020-11-17T13:51:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OmidShojaee](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/omidshojaee/32/2216_2.png) [@OmidShojaee](https://forum.djangoproject.com/u/OmidShojaee)\
**Post date:** [November 17, 2020, 1:51pm UTC](https://forum.djangoproject.com/t/static-root-vs-staticfiles-dirs/5241/1 "2020-11-17T13:51:16Z")

</div>

Hello,

I set the STATIC\_ROOT as:

`STATIC_ROOT = os.path.join(BASE_DIR, 'static')`

And it doesn’t work.

Then I remove it and set STATICFILES\_DIRS as:

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

```

And it works.

So, what is STATIC\_ROOT then?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 17, 2020, 2:11pm UTC](https://forum.djangoproject.com/t/static-root-vs-staticfiles-dirs/5241/2 "2020-11-17T14:11:04Z")

</div>

Covered in the docs:

- [Deployment](https://docs.djangoproject.com/en/3.1/howto/static-files/#deployment)
- [Static files](https://docs.djangoproject.com/en/3.1/ref/settings/#static-files)
- And associated with [collectstatic](https://docs.djangoproject.com/en/3.1/ref/contrib/staticfiles/#collectstatic)

---

<div class="post-metadata">

**Author:** ![SledgehammerPL](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/sledgehammerpl/32/18391_2.png) [@SledgehammerPL](https://forum.djangoproject.com/u/SledgehammerPL)\
**Post date:** [January 14, 2024, 1:27pm UTC](https://forum.djangoproject.com/t/static-root-vs-staticfiles-dirs/5241/3 "2024-01-14T13:27:46Z")

</div>

> <https://stackoverflow.com/questions/24022558/differences-between-staticfiles-dir-static-root-and-media-root>

```auto
STATIC_URL = '/static/'

if not DEBUG:
    STATIC_ROOT = '/home/django/www-data/example.com/static/'

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

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 14, 2024, 2:32pm UTC](https://forum.djangoproject.com/t/static-root-vs-staticfiles-dirs/5241/4 "2024-01-14T14:32:11Z")

</div>

I caution people against blindly believing what they read on SO. In this particular example, the most up-voted answer makes this blanket statement about the `STATIC_ROOT` setting:

> `STATIC_ROOT` is useless during development, it’s only required for deployment.

This is a dangerously-wrong assumption, and ignores those environments where development is done in an environment that attempts to mimic a production environment, or those situations where production environments are automatically built from the development environment.

It also goes on to say:

> You don’t even need to set it. Django looks for static files inside each app’s directory (`myProject/appName/static` ) and serves them automatically.

This is also wrong by saying that Django “serves them automatically.” These files are only served by `runserver` if it is configured to do so with the appropriate settings.

These requirements and the functionality provided by them are well documented in the official docs.

This is yet another example of why I caution people to not solely rely upon SO, and to not trust the answers found there without verifying what they have found through other resources.
