# Static File and Media Accessing issue while Deploying Django app in Production Environment

**URL:** <https://forum.djangoproject.com/t/static-file-and-media-accessing-issue-while-deploying-django-app-in-production-environment/11960>\
**Category:** Deployment\
**Created:** [February 3, 2022, 10:32pm UTC](https://forum.djangoproject.com/t/static-file-and-media-accessing-issue-while-deploying-django-app-in-production-environment/11960 "2022-02-03T22:32:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marly](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@marly](https://forum.djangoproject.com/u/marly)\
**Post date:** [February 3, 2022, 10:32pm UTC](https://forum.djangoproject.com/t/static-file-and-media-accessing-issue-while-deploying-django-app-in-production-environment/11960/1 "2022-02-03T22:32:32Z")

</div>

While deploying django app on production environment in **openlitespeed server,** static files and media files not found. App is woking fine in development environment in local, but after uploading it to server, static content and media files are not accessible.

I have updated my static url as follow:

```auto
STATIC_URL = '/public/static/'
STATIC_ROOT = '/home/domain.com/app/public/static'

```

Where **app** is the project location. I am getting 404 for error for all static and media files:

```auto
Failed to load resource: the server responded with a status of 404 ()

```

When I try `collectstatic` I am getting following error on terminal:

```auto
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.

```

I tried many options, none of the options worked. Any solution will be highly appreciated

---

<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:** [February 3, 2022, 11:07pm UTC](https://forum.djangoproject.com/t/static-file-and-media-accessing-issue-while-deploying-django-app-in-production-environment/11960/2 "2022-02-03T23:07:47Z")

</div>

You’re missing the close-quote on your STATIC\_ROOT line (I’ll assume it’s a copy/paste error.)

Does that directory exist? Collectstatic is not going to create it for you.

---

<div class="post-metadata">

**Author:** ![marly](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@marly](https://forum.djangoproject.com/u/marly)\
**Post date:** [February 4, 2022, 4:53am UTC](https://forum.djangoproject.com/t/static-file-and-media-accessing-issue-while-deploying-django-app-in-production-environment/11960/3 "2022-02-04T04:53:02Z")

</div>

Yes close-quote was not the problem and yes that directory exists as well.

---

<div class="post-metadata">

**Author:** ![marly](https://avatars.discourse-cdn.com/v4/letter/m/90db22/32.png) [@marly](https://forum.djangoproject.com/u/marly)\
**Post date:** [February 4, 2022, 6:34am UTC](https://forum.djangoproject.com/t/static-file-and-media-accessing-issue-while-deploying-django-app-in-production-environment/11960/4 "2022-02-04T06:34:33Z")

</div>

> [@marly](#):
>
> openlitespeed server

Problem Solved:

```auto
STATIC_ROOT = BASE_DIR / 'app/public/static'

```

I updated static\_root convention according to `Django >= 4.0` and on openlitespeed server every static content should be placed inside /public folder which is mandatory rule if we do not edit default configuration. I created /public folder and moved my static and media folder. And then did the collectstatic. Problem resolved.
