django第二個專案 使用模板

2021-09-08 01:22:07 字數 1518 閱讀 1962

第一步:

建立新專案secondproject

cd /tmp/

django-admin startproject secondeproject

第二步:

建立乙個用於放置模板資料夾

cd /tmp/secondeproject/

mkdir

templates

touch templates/template.html

template.html內容如下:

doctype html

>

<

html

>

<

head

>

<

title

>template page

title

>

head

>

<

body

>

}body

>

html

>

修改settings.py 配置模板儲存路徑

templates =[,},

]

第三步:

建立view.py檔案

touch /tmp/secondeproject/secondeproject/view.py

vim /tmp/secondeproject/secondeproject/view.py

view.py的內容如下

第四步:

修改urls.py 增加乙個hello對應的url

from django.conf.urls import

urlfrom django.contrib import

admin

from secondeproject.view import

fun_print_hello_world

urlpatterns =[

url(r

'^admin/

', admin.site.urls),

url(r

'^hello/

',fun_print_hello_world)

]

第五步:

訪問目標頁面

第二個專案總結

這個專案是製作乙個學院的簡單新聞 使用了html 5 css 3,以及相關的jquery外掛程式 輪播圖 進行搭建。布局方面因為不考慮響應式布局,因此沒有使用float屬性,而是利用display inline block屬性進行布局。1 webkit 對應chrome safari瀏覽器 2 mo...

第二個專案 多執行緒

建立執行緒 handle hthread1,hthread2 hthread1 createthread null,0,func1pro,this,0,null hthread2 createthread null,0,func2pro,this,0,null static dword winapi...

第二個作業!

作業要求 從鍵盤輸入乙個四位正整數。首先分離出該正整數中的每一位數字,並按逆序顯示輸出各位數字 然後用分離出的每位數字組成乙個最大數和乙個最小數,並顯示輸出。例如,若輸入的四位正整數為3175。按逆序顯示輸出分離出的各位數字為5713 組成的最大數為7531,組成的最小數為1357。具體要求 1 輸...