Django開發筆記

來源:互聯網
上載者:User
  1. 錯誤: No module named 模組名稱
    找不到模組,需要將模組添加到python的搜尋目錄中。
    方法一、在運行時添加參數--pythonpath="路徑"
    方法二、將路徑添加到path中。在settings.py中增加sys.path.insert(0,"path")
    方法三、安裝模組到python的dist-packages(有的系統是site-packages)檔案夾中
  2. 錯誤:Module "django.core.context_processors" doesnot define a"auth"
    callable request processor

    將TEMPLATE_CONTEXT_PROCESSORS中的django.core.context_processors.auth修改為django.contrib.auth.context_processors.auth
  3. 錯誤:Error importing template source loader django.template.loaders.filesystem.load_template_source: "'module' object has no attribute 'load_template_source'"
    將TEMPLATE_LOADERS的'django.template.loaders.filesystem.load_template_source'修改為'django.template.loaders.filesystem.Loader'
    另一個同樣去掉load_template_source
  4. 錯誤:Incorrect string value: '\xE5\x95\x8A\xE7\xAC\xAC...' for column 'name' at row 1
    將資料庫編碼修改為utf8,mysql的修改方式為:
    [mysqld]
    character-set-server=utf8
    [mysql]
    default-character-set=utf8
    資料表修改:alter database db_name character set utf8 collate utf8_general_ci;
  5. 錯誤:提示找不到模板檔案
    查看template路徑是否正確,路徑下是否有相應的檔案

註:很多錯誤是因為版本不同,api修改產生的。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.