When I want to "python manage.py makemigrations", it returns the following.
System check identified some issues:
WARNINGS
?: (staticfiles.W004) The directory '/static/' in the STATICFILES_DIRS setting does not exist.
How should I solve this issue?
from pathlib import Path import os  BASE_DIR = Path(__file__).resolve().parent.parent  ALLOWED_HOSTS = ['*']  INSTALLED_APPS = [     'django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',      'products',     'orders', ]
MIDDLEWARE = [     'django.middleware.security.SecurityMiddleware',     'django.contrib.sessions.middleware.SessionMiddleware',     'django.middleware.common.CommonMiddleware',     'django.middleware.csrf.CsrfViewMiddleware',     'django.contrib.auth.middleware.AuthenticationMiddleware',     'django.contrib.messages.middleware.MessageMiddleware',     'django.middleware.clickjacking.XFrameOptionsMiddleware', ]
ROOT_URLCONF = ‘rtu_server.urls'  TEMPLATES = [     {         'BACKEND': 'django.template.backends.django.DjangoTemplates',         'DIRS': [],         'APP_DIRS': True,         'OPTIONS': {             'context_processors': [                 'django.template.context_processors.debug',                 'django.template.context_processors.request',                 'django.contrib.auth.context_processors.auth',                 'django.contrib.messages.context_processors.messages',             ],         },     }, ]  WSGI_APPLICATION = ‘rtu_server.wsgi.application'
DATABASES = {     'default': {         'ENGINE': 'django.db.backends.sqlite3',         'NAME': BASE_DIR / 'db.sqlite3',     } }  AUTH_PASSWORD_VALIDATORS = [     {         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',     },     {         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',     },     {         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',     },     {         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',     }, ] 
LANGUAGE_CODE = 'en-us'  TIME_ZONE = 'Asia/Hong_Kong'  USE_I18N = True  USE_TZ = True   STATIC_URL = 'static/'  STATICFILES_DIRS = [     os.path.join(BASE_DIR, 'static') ]  DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'  MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
                It just says that you created STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] in your settings.py, but you didn't have any static folder in your project.
It is not a big issue right now because you might not be using external CSS or JS. But if you want to solve the issue, you can just create a static folder in your project.
Create a folder "static" in root directory if you still see error, then.
The problem is with this i believe,
BASE_DIR = Path(__file__).resolve().parent.parent
Let's say this is tree of folder where your "settings.py" is:
E:\\Project>Project>mySettings>settings.py
Then you have to modify BASE_DIR little bit like below,
BASE_DIR = Path(__file__).resolve().parent.parent.parent
one .parent for each folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With