Django下編譯項目出錯,需要安裝sqlite3


Django裝完,創建第一個項目,並運行:python manage.py runserver。提示出錯:

 

 raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc) django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3


需要安裝sqlite3.


SQLite3下載地址:http://www.sqlite.org/download.html


進入下載目錄,解壓文件tar -zxvf sqlite-amalgamation-3.7.3.tar.gz.

 

解壓后生成sqlite-3.7.3目錄. cd 進入sqlite-3.7.3。

./configure

make

sudo make install

安裝完成。

2測試

在任意目錄下新建一個數據庫,比如student ,

命令: sqlite3 student

出現如下提示:

 

SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

 

 

進入python安裝目錄,重新make/make install。

 

再運行:

python manage.py runserver

 

ok啦:

 

[root@node01 DjangoTest]# python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
March 29, 2016 - 01:40:27
Django version 1.9.1, using settings 'DjangoTest.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /
[29/Mar/2016 01:40:48] "GET / HTTP/1.1" 200 1767
Not Found: /favicon.ico
[29/Mar/2016 01:40:48] "GET /favicon.ico HTTP/1.1" 404 1940
Not Found: /favicon.ico
[29/Mar/2016 01:40:48] "GET /favicon.ico HTTP/1.1" 404 1940

 

 

 

在瀏覽器界面輸入:

[root@node01 DjangoTest]# python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
March 29, 2016 - 01:40:27
Django version 1.9.1, using settings 'DjangoTest.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /
[29/Mar/2016 01:40:48] "GET / HTTP/1.1" 200 1767
Not Found: /favicon.ico
[29/Mar/2016 01:40:48] "GET /favicon.ico HTTP/1.1" 404 1940
Not Found: /favicon.ico
[29/Mar/2016 01:40:48] "GET /favicon.ico HTTP/1.1" 404 1940

 

 

 

也能看到:

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM