0

I'm trying to deploy my django project using cpanel I have manage to show the HTML successfully but the style in static folder cannot be accessed

in stderr.log I got this error message Not Found: /static/assets/default/css/style.css

in setting.py I have static set like this

STATIC_URL = '/static'
STATICFILES_DIRS = (
    # location of your application, should not be public web accessible 
    './static',
)

in the HTML I use this to access the style sheet

<script src="{% static 'posApp/assets/default/css/style.css' %}"></script>

I have the folder like this

-pos
    -setting.py
-posApp
    -templates
             -login.html
-static
    -posApp
            -assets
                   -default
                           -css
                               -style.css

I have tried looking online my problem and also comparing my website in cpanel and my website that I run locaclly using localhost and could not find the answer why I get this error

Ivan Starostin
  • 8,798
  • 5
  • 21
  • 39
Stan
  • 1
  • You need to set STATIC_ROOT and run `collectstatic` before deployment. And on prod you should configure Nginx/Apache to serve static files. Django is not supposed to serve these files on production. And shown file path from error log actually does not match shown link from a template. – Ivan Starostin Jun 23 '23 at 16:21
  • Does this answer your question? [Django: cannot update css changes](https://stackoverflow.com/questions/53689833/django-cannot-update-css-changes) – Ivan Starostin Jun 23 '23 at 16:24

0 Answers0