title: How can add "templates " and "statics" folder in Django 3.1
body: <blockquote>
  <p>setting.py</p>
  </blockquote>
  <pre><code>from pathlib import Path
  
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
  BASE_DIR = Path(__file__).resolve().parent.parent
  
  #TEMPLATES_DIR = path.join(BASE_DIR, 'templates')    #it dosen't work
  #STATICS_DIR = path.join(BASE_DIR, 'statics')             #it also dosen't work
  
  # Quick-start development settings - unsuitable for production
  # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
  
  # SECURITY WARNING: keep the secret key used in production secret!
  SECRET_KEY = '0#nf@$8nm5jb0)meuq&amp;j6kztt534@nhk)k&amp;$zh=#emcxi7_7fo'
  
  # SECURITY WARNING: don't run with debug turned on in production!
  DEBUG = True
  
  ALLOWED_HOSTS = []
  
  
  # Application definition
  
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'musicianapp',
  ]
  
  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 = 'musicianList.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [TEMPLATES_DIR,],
          '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 = 'musicianList.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': BASE_DIR / 'db.sqlite3',
      }
  }
  
  
  # Password validation
  # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
  
  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',
      },
  ]
  
  
  # Internationalization
  # https://docs.djangoproject.com/en/3.1/topics/i18n/
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'UTC'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/3.1/howto/static-files/
  
  STATIC_URL = '/static/'
  STATICFILES_DIRS = [
      STATICS_DIR,
  ]
  </code></pre>
  <p>Please consern on the <strong>top</strong> and <strong>3rd top</strong> line where  is the main difference from <strong>Djago2.7 version</strong></p>
  <blockquote>
  <p>In Djnago2.7 where imported os as below,</p>
  </blockquote>
  <pre><code>import os
  
  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  </code></pre>
  <blockquote>
  <p>and I used the below code for connecting templates and statics forlder</p>
  </blockquote>
  <pre><code>TEMPLATES_DIR =os.path.join(BASE_DIR,&quot;templates&quot;)
  STATICS_DIR =os.path.join(BASE_DIR,&quot;statics&quot;)
  </code></pre>
  <blockquote>
  <p>But there is differece in form <strong>Djnago 3.1</strong>  <code>from pathlib imported Path</code>  given below,</p>
  </blockquote>
  <pre><code>from pathlib import Path
  
  # Build paths inside the project like this: BASE_DIR / 'subdir'.
  BASE_DIR = Path(__file__).resolve().parent.parent
  </code></pre>
  <blockquote>
  <p>and the os techinques dosen't works as below</p>
  </blockquote>
  <pre><code>TEMPLATES_DIR =os.path.join(BASE_DIR,&quot;templates&quot;)
  STATICS_DIR =os.path.join(BASE_DIR,&quot;statics&quot;)
  </code></pre>
  <p><em>How can I make connection with templates and statics folder, need help.</em></p>
  <p><strong>Note:</strong> I create templates and statics folders in main projects where already presented <strong>manage.py</strong> and <strong>db.sqlite3</strong> file. below the screenshot of my projects direction,</p>
  <p><a href="https://i.stack.imgur.com/UYCMr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UYCMr.png" alt="enter image description here" /></a></p>