I set my DEBUG variable to False
in setting.py
and deployed my project in cpanel
,used collectstatic command but static files not loading.
setting.py
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
if DEBUG:
STATICFILES_DIRS = [(
BASE_DIR / 'static/')
]
MEDIA_ROOT = os.path.join(BASE_DIR, "static_cdn", "media_root")
else:
STATIC_ROOT = "/home/smartsbi/public_html/static"
MEDIA_ROOT = "/home/smartsbi/public_html/media"
urls.py
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('home.urls')),
path('blog/', include('blog.urls')),
path('ckeditor/', include('ckeditor_uploader.urls')),
path('', include('contact_us.urls')),
path('', include('service.urls')),
]
if settings.DEBUG:
# add root static files
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
# add media static files
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)