# static files does not load at all

**URL:** <https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484>\
**Category:** Deployment\
**Created:** [August 29, 2023, 4:13pm UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484 "2023-08-29T16:13:16Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 29, 2023, 4:13pm UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/1 "2023-08-29T16:13:16Z")

</div>

I’ve deployed my django project “django\_chatbot” on an ubuntu server on Digitalocean. the user is “aras”, and the project folder is:  
“/home/aras/django\_chatbot”

In the settings.py file, I changed these lines:

```auto
ALLOWED_HOSTS = ['64.227.102.100']
STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/my_project/static/'

```

With “sudo nano /etc/nginx/sites-available/django\_chatbot” I’ve edited Nginx configuration :

```auto
server {
    listen 80;
    server_name 64.227.102.100;

    location = /favicon.ico { access_log off; log_not_found off; }

    location /static/ {
        alias /var/www/my_project/static/;
    }

    location / {
        include proxy_params;
        # Adjust this line for your .sock file
        proxy_pass http://unix:/home/aras/django_chatbot/django_chatbot.sock;
    }
{

```

After deploying this project on the server by this command:

```auto
gunicorn --bind 64.227.102.100:8000 django_chatbot.wsgi

```

my static files do not load on the website.  
My nginx log is:

```auto
[error] 32978#32978: *350 open() "/var/www/my_project/static/historypage.js" failed (2: No such file or directory), client: 185.180.140.141, server: 64.227.102.100, request: "GET /static/historypage.js HTTP/1.1", host: "64.227.102.100"
2023/08/29 04:09:07 [notice] 42213#42213: signal process started
2023/08/29 04:43:23 [notice] 42607#42607: signal process started
2023/08/29 04:43:23 [notice] 42613#42613: signal process started
2023/08/29 04:43:23 [notice] 42618#42618: signal process started
2023/08/29 04:43:23 [notice] 42624#42624: signal process started
2023/08/29 06:45:24 [notice] 43969#43969: signal process started
2023/08/29 06:57:16 [notice] 44086#44086: signal process started

```

Can any body help me?  
Thanks in advane

---

<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:** [August 29, 2023, 4:45pm UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/2 "2023-08-29T16:45:23Z")

</div>

Have you verified that that static file is in that directory?

Did you run `collectstatic` to copy the files there?

Does nginx have the appropriate access to those directories and files?

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 29, 2023, 5:40pm UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/4 "2023-08-29T17:40:57Z")

</div>

> Did you run `collectstatic` to copy the files there?

Yes,

> Does nginx have the appropriate access to those directories and files?

I’ve prepared nginx access for the “static” folder at: /var/www/my\_project/static/  
but not for the sub folders and files within that.  
It it necessary?

In the nginx log, I wonder about historypage.js failure to load. because i do not have such file in my static folder of my app. And the log does not cover other failure of logo and fonts.

---

<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:** [August 29, 2023, 5:52pm UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/5 "2023-08-29T17:52:28Z")

</div>

> [@amirelly](#):
>
> It it necessary?

Check the permissions. I don’t know what accounts you’re using or how you’re running your deployment process.

---

<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:** [August 29, 2023, 5:55pm UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/6 "2023-08-29T17:55:55Z")

</div>

> [@amirelly](#):
>
> And the log does not cover other failure of logo and fonts.

What url are you using to access your site?

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 30, 2023, 1:59am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/7 "2023-08-30T01:59:44Z")

</div>

> What url are you using to access your site?

64.227.102.106:8000

---

<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:** [August 30, 2023, 2:07am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/8 "2023-08-30T02:07:28Z")

</div>

So you’re bypassing nginx - or trying to anyway.

Your nginx configuration has:

> [@amirelly](#):
>
> ```auto
> server {
> listen 80;
> 
> ```

which means you should be accessing your site on port 80. (http)

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 30, 2023, 2:10am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/9 "2023-08-30T02:10:20Z")

</div>

Thanks Ken,  
Then what should I do to make it correct?

---

<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:** [August 30, 2023, 2:32am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/10 "2023-08-30T02:32:15Z")

</div>

Access your site on port 80, not 8000.

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 30, 2023, 2:49am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/11 "2023-08-30T02:49:13Z")

</div>

> Access your site on port 80, not 8000.

I’m sorry Ken, but you mean I have to run:

`gunicorn --bind 64.227.102.106:80 django_chatbot.wsgi`

?

---

<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:** [August 30, 2023, 2:51am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/12 "2023-08-30T02:51:20Z")

</div>

No. In your browser, when you go to the web site.  
Go to port 80 on the server, not 8000.

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 30, 2023, 3:06am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/13 "2023-08-30T03:06:09Z")

</div>

> Go to port 80 on the server, not 8000.

you mean I run:  
`gunicorn --bind 64.227.102.106:8000 django_chatbot.wsgi`  
but go to this IP to visit website?  
[http://64.227.102.106](http://64.227.102.106)

---

<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:** [August 30, 2023, 3:12am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/14 "2023-08-30T03:12:23Z")

</div>

Yes. Do not change any of your configuration (yet). Only change the url you enter in your browser.

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 30, 2023, 3:15am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/15 "2023-08-30T03:15:33Z")

</div>

OK,  
Now it is running, but cannot accessible without :8000 at the end of it.

---

<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:** [August 30, 2023, 3:17am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/16 "2023-08-30T03:17:33Z")

</div>

What do you mean? Provide more details about what you’re seeing, both in your browser and on the server.

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 30, 2023, 3:22am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/17 "2023-08-30T03:22:43Z")

</div>

on server:

```auto
gunicorn --bind 64.227.102.106:8000 django_chatbot.wsgi
[2023-08-30 03:18:31 +0000] [51021] [INFO] Starting gunicorn 21.2.0
[2023-08-30 03:18:31 +0000] [51021] [INFO] Listening at: http://64.227.102.106:8000 (51021)
[2023-08-30 03:18:31 +0000] [51021] [INFO] Using worker: sync
[2023-08-30 03:18:31 +0000] [51022] [INFO] Booting worker with pid: 51022

```

on browser:

 ![2023-08-30_065218](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/6/6ff105dee3d9e8475b31300cbf41fcfd83a995b3.jpeg)

---

<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:** [August 30, 2023, 3:24am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/18 "2023-08-30T03:24:12Z")

</div>

What about your nginx log?

---

<div class="post-metadata">

**Author:** ![amirelly](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/amirelly/32/15676_2.png) [@amirelly](https://forum.djangoproject.com/u/amirelly)\
**Post date:** [August 30, 2023, 3:39am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/20 "2023-08-30T03:39:34Z")

</div>

```auto
sudo tail -f /var/log/nginx/access.log
104.43.161.68 - - [30/Aug/2023:03:18:15 +0000] "GET /shop/wp-includes/wlwmanifest.xml HTTP/1.1" 404 564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
104.43.161.68 - - [30/Aug/2023:03:18:16 +0000] "GET /wp1/wp-includes/wlwmanifest.xml HTTP/1.1" 404 564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
104.43.161.68 - - [30/Aug/2023:03:18:16 +0000] "GET /test/wp-includes/wlwmanifest.xml HTTP/1.1" 404 564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
104.43.161.68 - - [30/Aug/2023:03:18:16 +0000] "GET /site/wp-includes/wlwmanifest.xml HTTP/1.1" 404 564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
104.43.161.68 - - [30/Aug/2023:03:18:17 +0000] "GET /cms/wp-includes/wlwmanifest.xml HTTP/1.1" 404 564 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
104.43.161.68 - - [30/Aug/2023:03:18:17 +0000] "" 400 0 "-" "-"
4.17.224.131 - - [30/Aug/2023:03:33:35 +0000] "GET /laravel/.env HTTP/1.1" 404 159 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
4.17.224.131 - - [30/Aug/2023:03:33:35 +0000] "POST /laravel HTTP/1.1" 404 159 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36"
107.170.232.21 - - [30/Aug/2023:03:46:46 +0000] "GET / HTTP/1.1" 200 712 "-" "Mozilla/5.0 zgrab/0.x"
45.79.128.205 - - [30/Aug/2023:03:51:15 +0000] "\x16\x03\x01\x00\x85\x01\x00\x00\x81\x03\x03\xD5\x99\xA3l\xA5\x0Cag!5.\x8DQ\x912\xE4-\x80\x9C\xBC\xCE\x9DGL\xA2e\x10\xAA\x7F\x05\x01*\x00\x00 \xC0/\xC00\xC0+\xC0,\xCC\xA8\xCC\xA9\xC0\x13\xC0\x09\xC0\x14\xC0" 400 166 "-" "-"

```

---

<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:** [August 30, 2023, 11:48am UTC](https://forum.djangoproject.com/t/static-files-does-not-load-at-all/23484/21 "2023-08-30T11:48:50Z")

</div>

What about your error log? (Note, it may be helpful to filter your logs by only displaying lines with your ip address to screen out all the bot traffic.)
