Mac OS 使用PyCharm 啓動Python Django程序報錯 解決方案

報錯信息圖片django

報錯信息文字圖片

django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.it

 

解決方案:io

manage.py 添加如下內容import

import os  #若是manage.py頂部有這個引入,那麼這條能夠不寫
os.environ['DJANGO_SETTINGS_MODULE'] = 'root.settings'
相關文章
相關標籤/搜索