# Static files are not found

**URL:** <https://forum.djangoproject.com/t/static-files-are-not-found/25158>\
**Category:** Deployment\
**Created:** [November 8, 2023, 11:19pm UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158 "2023-11-08T23:19:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![blactrader](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/blactrader/32/16875_2.png) [@blactrader](https://forum.djangoproject.com/u/blactrader)\
**Post date:** [November 8, 2023, 11:19pm UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/1 "2023-11-08T23:19:40Z")

</div>

Hi, i need help with my project as after deployment when viewing my site only html files without (css, js and images) below is the my settings.py on static files

```auto
STATIC_URL = '/static/'
STATICFILES_ROOT = [
    os.path.join(BASE_DIR, '/static')
]

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

```

and below is the project static file arrangement

 ![Screenshot from 2023-11-09 02-04-14](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/f/d/fdd069fa0de46d1f2c58118e7557339a92e235c3.png)

after running collecting static the files were placed at home directory inside a folder named nyawiguschool/statics

---

<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 8, 2023, 11:28pm UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/2 "2023-11-08T23:28:49Z")

</div>

Your web server then needs to be configured to serve files from the `static` url from the directory where the static files get placed.

---

<div class="post-metadata">

**Author:** ![blactrader](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/blactrader/32/16875_2.png) [@blactrader](https://forum.djangoproject.com/u/blactrader)\
**Post date:** [November 8, 2023, 11:50pm UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/3 "2023-11-08T23:50:38Z")

</div>

okay, and how do i do that please show me an example

---

<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 9, 2023, 1:45am UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/4 "2023-11-09T01:45:29Z")

</div>

What web server are you using? (Nginx? Apache? Something else?) What is your configuration for your project for your server?

---

<div class="post-metadata">

**Author:** ![HarshaReddyV](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/harshareddyv/32/16077_2.png) [@HarshaReddyV](https://forum.djangoproject.com/u/HarshaReddyV)\
**Post date:** [November 9, 2023, 10:16am UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/5 "2023-11-09T10:16:08Z")

</div>

Hi, Same error occurred to me after adding js and images.

Try installing whitenoise middleware which serves static files without the server.

Pip/pip3 install whitenoise and include it in the installed apps

```auto
INSTALLED_APPS = [
    'home',
    'forum',
    'ckeditor',
    'whitenoise.runserver_nostatic',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles'
]

```

Include it in the middleware

```auto
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    "whitenoise.middleware.WhiteNoiseMiddleware",
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

```

Include the following in settings.py

```auto
STATICFILES_STORAGE = ('whitenoise.storage.CompressedManifestStaticFilesStorage')
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

```

I am using it as a temporary fix. if you are using large number of media files you might have to find an alternative.  
Let me know if it worked.

---

<div class="post-metadata">

**Author:** ![blactrader](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/blactrader/32/16875_2.png) [@blactrader](https://forum.djangoproject.com/u/blactrader)\
**Post date:** [November 12, 2023, 8:10am UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/6 "2023-11-12T08:10:19Z")

</div>

> [@HarshaReddyV](#):
>
> ```auto
> STATICFILES_STORAGE = ('whitenoise.storage.CompressedManifestStaticFilesStorage')
> STATIC_URL = '/static/'
> STATIC_ROOT = os.path.join(BASE_DIR, 'static'
> 
> ```

Thanks for reply however the solution dont seems to work on my side

---

<div class="post-metadata">

**Author:** ![blactrader](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/blactrader/32/16875_2.png) [@blactrader](https://forum.djangoproject.com/u/blactrader)\
**Post date:** [November 12, 2023, 8:10am UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/7 "2023-11-12T08:10:53Z")

</div>

Am using LiteSpeed server

---

<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 12, 2023, 1:15pm UTC](https://forum.djangoproject.com/t/static-files-are-not-found/25158/8 "2023-11-12T13:15:19Z")

</div>

Then we need to see your LightSpeed configuration file for your application.

Also, are you using OpenLightSpeed or the commercial version? Is this a host that you have full control over or a shared host?

There seems to be a pretty good guide at [Running Python WSGI Apps with LSAPI – OpenLiteSpeed](https://openlitespeed.org/kb/python-wsgi-applications/#HowtosetupforDjango)
