date: 2016-10-12 20:02:29
學(xué)Python也有一段時(shí)間了,學(xué)完基本語(yǔ)法后整個(gè)人都蒙了拼卵。沒(méi)有什么可以來(lái)練手,感覺(jué)什么也不會(huì)腥刹。
準(zhǔn)備主攻爬蟲(chóng)和Web贱鼻。
宴卖。
C/S結(jié)構(gòu)和B/S結(jié)構(gòu)
C/S-Client/Server 客戶機(jī)/服務(wù)器結(jié)構(gòu)
B/S-Browser/Server 瀏覽器/服務(wù)器結(jié)構(gòu)
B/S優(yōu)勢(shì):
- 不用安裝軟件
- 不用通知升級(jí)
- 輕松跨平臺(tái)
訪問(wèn)網(wǎng)站過(guò)程:
- 用戶向Web服務(wù)器發(fā)起請(qǐng)求
- Web服務(wù)器返回html給用戶
- 用戶瀏覽器將html渲染成網(wǎng)頁(yè)
靜態(tài)網(wǎng)站
用戶向Web服務(wù)器請(qǐng)求,Web服務(wù)器會(huì)直接將html返回給用戶邻悬。
動(dòng)態(tài)網(wǎng)站
- 用戶向Web服務(wù)器請(qǐng)求症昏。
- Web服務(wù)器執(zhí)行Python程序,將執(zhí)行結(jié)果輸出成html文件返回給用戶父丰。Web服務(wù)器可以修改html文件結(jié)果肝谭。網(wǎng)站會(huì)因?yàn)橛脩舻恼?qǐng)求不同的呈現(xiàn)出不同的結(jié)果。也就是動(dòng)態(tài)網(wǎng)站的由來(lái)蛾扇。
采用MVC設(shè)計(jì)Web應(yīng)用
M: Model模型攘烛,存儲(chǔ)Web應(yīng)用數(shù)據(jù)的代碼
V: View視圖,格式化和顯示W(wǎng)eb應(yīng)用的用戶界面的代碼镀首。
C: Controller控制器医寿,將Web應(yīng)用粘合在一起并提供業(yè)務(wù)邏輯的代碼。
CGI
Common Gateway Interface 通用網(wǎng)關(guān)接口
可以讓一個(gè)客戶端蘑斧,從網(wǎng)頁(yè)瀏覽器向服務(wù)器請(qǐng)求數(shù)據(jù)靖秩。這是描述客戶端和服務(wù)器程序之間傳輸數(shù)據(jù)的一種標(biāo)準(zhǔn)须眷。
應(yīng)用于Web的編程語(yǔ)言
PHP
ASP/ASP.net
JSP
Python
前端程序
HTMl
CSS
JS
后臺(tái)程序
Python
PHP
JSP
數(shù)據(jù)庫(kù) --與后臺(tái)程序進(jìn)行數(shù)據(jù)交互
Mysql
MongoDB
前端
- HTML:Hyper Text Markup Language 超文本標(biāo)記語(yǔ)言
- CSS:Cascading Style Sheet 層疊樣式表
- JS :JavaScript
后端
Python
PHP
JSP
···
數(shù)據(jù)庫(kù)及靜態(tài)存儲(chǔ)
- Mysql
- SQLite
- MongoDB
HTML和JavaScript的簡(jiǎn)單介紹
目標(biāo):使用HTML語(yǔ)言和JS語(yǔ)言,編寫程序沟突。實(shí)現(xiàn)兩數(shù)相加花颗。
新建index.html文件:
<head>
<title>Calculator</title>
<script src="add.js" type="text/javascript"></script>>
</head>
<body>
<div align="center" style="margin-top:60px;">
<form name="form1">
<input type="text" placeholder="adder" name="adder1">
<input type="text" placeholder="adder-2" name="adder2">=
<input type="text" readonly="readonly" placeholder="result" name="result">
<input type="button" value="calculate" onclick="add()">
</form>
</div>
</body>
<footer>
</footer>
新建add.js文件:
<pre>
function add()
{
var adder1=Number(document.form1.adder1.value);
var adder2=Number(document.form1.adder2.value);
var result=adder1+adder2;
document.form1.result.value=result;
}
</pre>
顯示為:
<head>
<title>Calculator</title>
<script src="add.js" type="text/javascript"></script>>
</head>
<body>
<div align="center" style="margin-top:60px;">
<form name="form1">
<input type="text" placeholder="adder" name="adder1">
<input type="text" placeholder="adder-2" name="adder2">=
<input type="text" readonly="readonly" placeholder="result" name="result">
<input type="button" value="calculate" onclick="add()">
</form>
</div>
</body>
<footer>
</footer>
上面的只是html文件,不能計(jì)算出結(jié)果惠拭。