需求
我是看到tango with django的1.7版本經(jīng)常國內(nèi)訪問不到,而自己又需要參考來編程,所以,自己先把網(wǎng)頁拷貝下來,已備以后使用。
如何做?
由于tangowithdjango這本書都是靜態(tài)頁面
可以通過wget的命令把別人的整個(gè)網(wǎng)頁copy過來。而我自己本身有一個(gè)nginx的服務(wù)器跑著,所以只需要下載相應(yīng)的網(wǎng)址到我的主機(jī)就是了。
步驟
- 在(VPS/本機(jī)的)的終端中輸入:
[sudo] wget -r --no-parent http://www.tangowithdjango.com/book17/
http://www.tangowithdjango.com/book17/ 是1.7版本的URI
-r代表遞歸,所以就是說這個(gè)URI中的所有資源都需要wget下來;平時(shí)需要慎用此命令。
--no-parent代表不要追溯到父目錄 - 如果有VPS, 將文件夾的owner改為www-data(nginx), www(apache)
另外記得把網(wǎng)址更改了。如果是mac中自用,則打開index即可以瀏覽
log
~~ 在發(fā)起wget命令之后,VPS會(huì)自動(dòng)遞歸獲取http://www.tangowithdjango.com/book17/此文件夾中的文件??梢钥吹匠晒ο螺d的文件的日志。
<code>
--2016-05-14 03:31:32-- http://www.tangowithdjango.com/book17/
Resolving www.tangowithdjango.com (www.tangowithdjango.com)... 50.19.109.98
Connecting to www.tangowithdjango.com (www.tangowithdjango.com)|50.19.109.98|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 44861 (44K) [text/html]
Saving to: 'www.tangowithdjango.com/book17/index.html'
100%[======================================>] 44,861 --.-K/s in 0.1s
2016-05-14 03:31:32 (335 KB/s) - 'www.tangowithdjango.com/book17/index.html' saved [44861/44861]
……
--2016-05-14 03:31:32-- http://www.tangowithdjango.com/book17/_static/pygments.css
Reusing existing connection to www.tangowithdjango.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 3932 (3.8K) [text/css]
Saving to: 'www.tangowithdjango.com/book17/_static/pygments.css'
100%[======================================>] 3,932 --.-K/s in 0s
2016-05-14 03:31:32 (661 MB/s) - 'www.tangowithdjango.com/book17/_static/pygments.css' saved [3932/3932]
……
</code>
Reference
http://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/wget.html
https://www.quora.com/Where-can-I-download-Tango-with-Django
http://www.tangowithdjango.com/book17/