# static files not working in template

**URL:** <https://forum.djangoproject.com/t/static-files-not-working-in-template/16124>\
**Category:** Templates & Frontend\
**Created:** [September 23, 2022, 7:52am UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124 "2022-09-23T07:52:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rwahdan1978](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rwahdan1978/32/9932_2.png) [@rwahdan1978](https://forum.djangoproject.com/u/rwahdan1978)\
**Post date:** [September 23, 2022, 7:52am UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124/1 "2022-09-23T07:52:13Z")

</div>

I have a problem with my template accessing my static folder.

```auto
{% load static %}

<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Rami Wahdan Hotels</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
   
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
    <link rel="stylesheet" href="{% static 'css/animate.css' %}">
    <link rel="stylesheet" href="{% static 'css/owl.carousel.min.css' %}">
    <link rel="stylesheet" href="{% static 'css/aos.css' %}">
    <link rel="stylesheet" href="{% static 'css/bootstrap-datepicker.css' %}">
    <link rel="stylesheet" href="{% static 'css/jquery.timepicker.css' %}">
    <link rel="stylesheet" href="{% static 'css/fancybox.min.css' %}">
    
    <link rel="stylesheet" href="{% static 'fonts/ionicons/css/ionicons.min.css' %}">
    <link rel="stylesheet" href="{% static 'fonts/fontawesome/css/font-awesome.min.css' %}">

    <!-- Theme Style -->
    <link rel="stylesheet" href="{% static 'css/style.css' %}">
  </head>
  <body>

```

my structure is:

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/c/c7fd9834236abe146f0eb8fd914db0ce6829c23e.png)

in settings.py i put:

```auto
STATIC_URL = 'static/'

```

it is not working…

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/b/b31c629e3537ad943e50919e0e8ed7a0b2866b70.png)

what is wrong?

---

<div class="post-metadata">

**Author:** ![Spha](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/spha/32/9509_2.png) [@Spha](https://forum.djangoproject.com/u/Spha)\
**Post date:** [September 23, 2022, 8:22am UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124/2 "2022-09-23T08:22:57Z")

</div>

It shouldn’t be in that folder, I think you have it in the app folder, it needs to be in the project root directory I believe. So the “teacher site” folder I think. Or else change the path in settings for STATIC\_URL

```auto
import os
STATIC_URL = '/websites/mysite/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

# you might have to collect static again after you make this change

python manage.py collectstatic

```

---

<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:** [September 23, 2022, 1:01pm UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124/3 "2022-09-23T13:01:32Z")

</div>

How are you running your application? Is this a test environment using `runserver`, or is this a production environment?

What are your other static file-related settings? (STATICFILES\_DIRS, STATICFILES\_FINDERS, STATIC\_ROOT)

See [How to manage static files (e.g. images, JavaScript, CSS) | Django documentation | Django](https://docs.djangoproject.com/en/4.1/howto/static-files/) for the full list of things to check.

---

<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:** [September 23, 2022, 1:02pm UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124/4 "2022-09-23T13:02:51Z")

</div>

> [@Spha](#):
>
> `STATIC_URL = '/websites/mysite/static/'`

This is not necessary and generally not recommended. There is absolutely no need to associate your `STATIC_URL` with the physical directory in which static files are stored.

---

<div class="post-metadata">

**Author:** ![Spha](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/spha/32/9509_2.png) [@Spha](https://forum.djangoproject.com/u/Spha)\
**Post date:** [September 23, 2022, 2:19pm UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124/5 "2022-09-23T14:19:40Z")

</div>

Fair enough - I was also thinking in my head it should probably be left alone as `STATIC_URL = 'static/'`  
It looks like “mysite” is an app

@ [rwahdan1978](https://forum.djangoproject.com/u/rwahdan1978)  
this is the normal layout of a django project hierarchy

 ![](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/4/45c999a8e9ea363985b8ce60e3712c72fb0759da.jpeg)  
source:

> **[How To Structure Your Django Project](https://python.plainenglish.io/how-to-structure-your-django-project-a5d50333a644)**
>
> Understanding the file structure and project layout of a Django web application.

---

<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:** [September 23, 2022, 2:25pm UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124/6 "2022-09-23T14:25:25Z")

</div>

Note: It is also normal to have a `static` directory in an app.

See [Settings | Django documentation | Django](https://docs.djangoproject.com/en/4.1/ref/settings/#staticfiles-finders)

---

<div class="post-metadata">

**Author:** ![rwahdan2022](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rwahdan2022/32/7584_2.png) [@rwahdan2022](https://forum.djangoproject.com/u/rwahdan2022)\
**Post date:** [September 24, 2022, 6:15am UTC](https://forum.djangoproject.com/t/static-files-not-working-in-template/16124/7 "2022-09-24T06:15:21Z")

</div>

Thanks I put the static folder in the right place now it’s working.
