0

When I run my project in my localhost it works perfect. But when I deploy iti cannot find css files. That's why looks bad and doesn't get any style. How can I fix it?

settings.py

...
STATIC_URL = '/static/'
STATICFILES_DIRS = (os.path.join('static'),)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
...

this is my structure

Note: And I don't know if it is related but there is an error in console:

Refused to apply style from 'https://...ing.com/static/css/signup.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

zarsamm
  • 3
  • 2
edche
  • 636
  • 6
  • 33

2 Answers2

0

Adding following snippet into settings.py file may fix your problem:

import mimetypes
mimetypes.add_type("text/css", ".css", True)

check this answer

Also This

SANGEETH SUBRAMONIAM
  • 1,098
  • 1
  • 9
  • 10
0

in your STATICFILES_DIRS..you are missing the argument BASE_DIR

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

In your URL you can ass this

 from django.conf.urls.static import static
    urlpatterns = [
           #Your patters
       ]+static(settings.MEDIA_URL, 
      document_root=settings.MEDIA_ROOT)
Kenneth Githambo
  • 179
  • 2
  • 18