天天看點

django python (1) 模闆使用

模闆下載下傳下來後 首先将 js css 等檔案分離

django python (1) 模闆使用

這種結構比較合理 

templates當中存放html檔案

static當中存放css等檔案

修改dirs的位置 指向放html的檔案夾

'DIRS': [BASE_DIR+"/templates",],       # 修改位置
      
           

修改地區

增加staticfiles_dirs 變量 将檔案夾位址都放入

LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'Asia/Shanghai'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'
HERE = os.path.dirname(os.path.abspath(__file__))
HERE = os.path.join(HERE, '../')

STATICFILES_DIRS = (
   os.path.join(HERE, 'static/'),
   os.path.join(HERE, 'templates/'),
)