日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

django 静态数据_如何在Django中使用静态数据?

發(fā)布時間:2023/12/1 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 django 静态数据_如何在Django中使用静态数据? 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

django 靜態(tài)數(shù)據(jù)

Static Data means those data items that we cannot want to change, we want to use them as it is like audio, video, images, files etc.

靜態(tài)數(shù)據(jù)是指我們不想更改的數(shù)據(jù)項,我們想像音頻,視頻,圖像,文件等那樣使用它們。

Here, are the steps to create an application that will demonstrate the use of static data in Django:

以下是創(chuàng)建應用程序的步驟,這些應用程序?qū)⒀菔綝jango中靜態(tài)數(shù)據(jù)的使用 :

Step 1: Create a Sandbox, Activate it, Install Django and Create Sample Project

步驟1:創(chuàng)建一個沙箱,將其激活,安裝Django并創(chuàng)建示例項目

Creating Sandbox

創(chuàng)建沙箱

Activating it

激活它

Installing Django

安裝Django

Creating Sample Project [myapp]

創(chuàng)建示例項目[myapp]

Project Structure [myapp]

項目結(jié)構(gòu)[myapp]

Step 2: Add a new folder (i.e. static) in root location (i.e. myapp folder[outer])

步驟2:在根目錄(即myapp文件夾[外部])中添加一個新文件夾(即靜態(tài))

Step 3: Add Static Data (audio, videos etc) inside static folder

步驟3:在靜態(tài)文件夾中添加靜態(tài)數(shù)據(jù)(音頻,視頻等)

.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}

Step 4: Add static folder path to settings.py of admin app (i.e. myapp[inner])

步驟4:將靜態(tài)文件夾路徑添加到管理應用程序的settings.py(即myapp [inner])

Step 5: Add a new folder templates for HTML Templates in project folder (i.e. myapp[outer])

步驟5:在項目文件夾中為HTML模板添加新的文件夾模板(即myapp [outer])

Step 6: Add templates location to setting.py in admin app (i.emyapp[inner])

步驟6:將模板位置添加到管理應用中的setting.py(i.emyapp [inner])

Step 7: Add a master page (base.html) in templates folder

步驟7:在模板文件夾中添加母版頁(base.html)

Different sections of Body Tag of base.html

base.html正文標記的不同部分

.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}

Step 8: Now Add child pages (i.e. index.html, audio.html, video.html, image.html, pdf.html)

步驟8:現(xiàn)在添加子頁面(即index.html,audio.html,video.html,image.html,pdf.html)

Index.html

Index.html

Audio.html

Audio.html

Video.html

Video.html

Image.html

Image.html

Pdf.html

Pdf.html

Step 9: Add a controller file (views.py) to manage views in admin app (i.e. myapp[inner])

第9步:添加控制器文件(views.py)以管理管理應用程序中的視圖(即myapp [inner])

.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}

Step 10: Add controller actions (functions) to views.py to manage requests.

步驟10:將控制器動作(功能)添加到views.py以管理請求。

Step 11: Add new url to urls.py in admin app (i.e. myapp[inner])

第11步:在管理應用程序(即myapp [inner])中將新的url添加到urls.py中

Step 12: Run the Server

步驟12:運行服務器

Step 13: Open Browser and type http://127.0.0.1:8000

步驟13:打開瀏覽器并輸入http://127.0.0.1:8000

翻譯自: https://www.includehelp.com/Django/how-to-use-static-data-in-django.aspx

django 靜態(tài)數(shù)據(jù)

總結(jié)

以上是生活随笔為你收集整理的django 静态数据_如何在Django中使用静态数据?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。