1. Make sure that django.contrib.staticfiles is included in your INSTALLED_APPS <https://django.readthedocs.io/en/stable/ref/settings.html#std-setting-INSTALLED_APPS> 2. also if it already included, adding the following snippet to your urls.py : ----------------------------------------------------------------------------------------------------------------------- from django.conf import settings from django.conf.urls.static import static
urlpatterns = [ # others urls, ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) ----------------------------------------------------------------------------------------------------------------------- 3. also in your settings.py adding STATIC_ROOT, make sure you have "pathlib" imported above: ----------------------------------------------------------------------------------------------------------------------- from pathlib import Path # ... # ... other code # ... STATIC_URL = "static/" STATIC_ROOT = Path.joinpath(BASE_DIR, STATIC_URL) ----------------------------------------------------------------------------------------------------------------------- or if you prefer os module adding this instead in settings.py ----------------------------------------------------------------------------------------------------------------------- import os # ... # ... other code # ... STATIC_URL = "static/" STATIC_ROOT = os.path.join(BASE_DIR, STATIC_URL) ----------------------------------------------------------------------------------------------------------------------- Although this is not suitable for production, only for development. for production -> deployment https://docs.djangoproject.com/en/4.2/howto/static-files/deployment/ I hope this help. ในวันที่ วันเสาร์ที่ 27 พฤษภาคม ค.ศ. 2023 เวลา 23 นาฬิกา 28 นาที 21 วินาที UTC+7 Ramesh Parajuli เขียนว่า: > Please help me: -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a27080c6-bdbc-4c7b-9f6e-9817bf0496e1n%40googlegroups.com.