Answer the question
In order to leave comments, you need to log in
Why doesn't Django-CMS see custom CSS/JS?
Django-CMS refuses to see static files in a project's static directory. Those that are created manually - just do not find. And those that were installed with django and django-cms are still taken from ../env/lib/python3.6/site-packages/cms/static/cms/
collectstatic did.
settings.py
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
urlpatterns = [
path('admin/', admin.site.urls),
]
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += [url(r'^', include('cms.urls')),]
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
Answer the question
In order to leave comments, you need to log in
1. Try to accurately specify the BASE_DIR path. I've done it like this:
2. In urls.py try this:
urlpatterns = [
somethingurls
]+static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question