Windows下安裝django web架構

來源:互聯網
上載者:User

1、 python的安裝

      在安裝之前肯定是要先安裝python了,我是用的python2.7

 

因為django還不支援3.0的版本就只能用2.7的了。python http://www.python.org/ 

 

2、安裝django

 

    (1)cmd中cd到你安裝的django的安裝目錄下,可以看到setup.py這個檔案 。

 

 然後再cmd中執行 python setup.py install ,現在命令列已經自動開始安裝django了。django

 

 http://www.djangoproject.com/download/

 

   (2)然後在cmd中輸入命令 

     :python 
    >>>import django 
    >>>django.VERSION 
    >>>(1,2,3,'final',0) 
   以上資訊顯示的django的版本資訊,說明安裝已經成功。

 

 (3)建立工程

    django安裝在python目錄下這個django-admin.py在python27/scripts目錄下 

    所以cd到該目錄 
    執行django-admin.py startproject mysite

    工程建立成功

 

(4)運行

 cd到mysite 
    執行命令 
     python manage.py runserver  
    然後會顯示如下資訊: 
Validating models...   
0 errors found   
  
Django version 1.2.3, using settings 'mysite.settings'  
Development server is running at http://127.0.0.1:8000/   
Quit the server with CTRL-BREAK.   
[22/Oct/2010 13:28:14] "GET / HTTP/1.1" 200 2051 

接下來在瀏覽器輸入http://127.0.0.1:8000/ 
會顯示如下資訊: 
It worked! 
Congratulations on your first Django-powered p

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.