From 36b52a41f7ba629cfab38dbdb4e4a768b2ae87e6 Mon Sep 17 00:00:00 2001 From: isbasic Date: Sat, 23 May 2015 20:02:20 +0800 Subject: [PATCH 1/7] add favicon --- hello.py | 2 +- static/favicon.ico | Bin 0 -> 4286 bytes templates/base.html | 5 +++++ templates/index.html | 11 ++++++++++- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 static/favicon.ico diff --git a/hello.py b/hello.py index e20ae2e..01d7e3b 100644 --- a/hello.py +++ b/hello.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template +from flask import Flask, render_template, url_for from flask.ext.script import Manager from flask.ext.bootstrap import Bootstrap diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..d8c470718d643c13dcf778aecc2980634bad2a04 GIT binary patch literal 4286 zcmcIo2UJv78h&CxW85{G)nGJPvcwdkNp#g%js_Deh-E;K0R&M&qzDMoOArAKMNtBZ zG(ozBV5N&l9YBWOae#pVX%aUEfq%a{k(``8p0ha#xtwp_efRzM|NeIGeGiVCfRICj1G+iu&dS13o=3%}aMiX5kEe zU5CSbyN>|uY8vL(Wg6}$Hi_^PABha;#JGs>Wm~t))x2zr^?|I_2Q}gpwygA={)xOU zH*W@u6SINEfwkAT8B^a{u;~i}y#VLif$3Mp;icI>MmLp?ToKodC-yZ{!eA@K^*2*= ze-p(6aX@5WBSrN!P&BTwxDQAF5)j$nNQnc@bPaQ&o-|NIN7Yz(W694Ug3O^)S=Un7Yf;_|ma_T4| zr}jenw!Mhl07p?iIf)9$8E_R9($U9x}&?%*_U%O>-dY%*?6 zC*!7cI@oxRj2iCI{)XGQ-l6^Vw@4p2*l?GO8`J0jo*#ysNpmJywcRJn$GPOvQAn}S zo7l(V*G$QsHN(n|1}0MP5q~u=bB9}!#*wpH&x8;!=`i9`# zUw@OdYOj%cO%iF=Buk-zzJ6T_8PuneE?@vTtJZ9~*e#@Et+1grhfa2sP(*L7G=Dd{ z8%B2cSlF}JN3|An>+E&(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b%l_S5dGrfVvokgMjr;&$Cv?+$5UW3r~!8Qy=~$Ej&d#y}j73wMSoL^)H5+NS+q{1@T#k@Wxo literal 0 HcmV?d00001 diff --git a/templates/base.html b/templates/base.html index 00cbdd7..4fd3f64 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,11 @@ {% extends "bootstrap/base.html" %} {% block title %}Flasky{% endblock %} +{% block head %} +{{ super() }} + + +{% endblock %} {% block navbar%} {% endblock %} + +{% block scripts %} +{{ super() }} +{{ moment.include_moment() }} +{% endblock %} diff --git a/templates/index.html b/templates/index.html index b6ed5de..375c536 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,4 +7,6 @@ +

The local date and time is {{ moment(current_time).format('LLL') }}.

+

That was {{ moment(current_time).fromNow(refresh=True) }}

{% endblock %} From b890cbf825e52218de6e6edf35ef7dca9fb4ef72 Mon Sep 17 00:00:00 2001 From: isbasic Date: Sat, 23 May 2015 21:09:49 +0800 Subject: [PATCH 4/7] update README.md --- README.md | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2955449..97ac777 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,41 @@ <<<<<<< HEAD -Flasky -====== +#Flasky +======== +##参考书的描述 +>This repository contains the source code examples for my O'Reilly book [Flask Web Development](http://www.flaskbook.com). +以上是原书信息的一些描述 -This repository contains the source code examples for my O'Reilly book [Flask Web Development](http://www.flaskbook.com). +>跟着书本敲代码,存储到这里,敲完了再考虑什么时候写点作业好了 -跟着书本敲代码,存储到这里,敲完了再考虑什么时候写点作业好了 +##关于manage.run()的运行参数引用 +>运行hello.py,会显示一个用法消息: +``` +$python hello.py +usage: hello.py [-h] {shell,runserver}... + +positional arguments: +{shell, runserver} +shell >在Flask应用上下文中运行Python shell +runserver >运行Flask开发服务器:app.run() + +optional arguments: +-h, --help >显示帮助信息并退出 +``` +>shell命令用于在程序的上下文中启动Python shell会话。可以使用这个会话运行维护任务或测试、调试异常。 + +>runserver命令用来启动web服务器,运行 python pyfile.py runserver将以调试模式启动web服务器,以下还有其他选项可用: +''' +(venv) $ python pyfile.py runserver --help +usage: pyfile.py runserver [-h] [-t HOST] [-p PORT] [--threaded] + [--processes PROCESSES] [--passthrough-errors] [-d] + [-r] +''' +>examples +''' +python pyfile.py runserver --host 0.0.0.0 --port 9000 +* Running on http://0.0.0.0:9000/ +* Restarting with reload +''' +======== -======= -# flasky -一个Flask框架的代码学习仓库 >>>>>>> cc1796ed8b7e2f74839b21d883acf8dc9c13e1f1 From 07319094869308e3d729c19bce1ea88ee47abf21 Mon Sep 17 00:00:00 2001 From: isbasic Date: Sat, 23 May 2015 21:16:28 +0800 Subject: [PATCH 5/7] change some label --- README.md | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 97ac777..9e8b7bc 100644 --- a/README.md +++ b/README.md @@ -3,39 +3,37 @@ ======== ##参考书的描述 >This repository contains the source code examples for my O'Reilly book [Flask Web Development](http://www.flaskbook.com). + 以上是原书信息的一些描述 ->跟着书本敲代码,存储到这里,敲完了再考虑什么时候写点作业好了 +跟着书本敲代码,存储到这里,敲完了再考虑什么时候写点作业好了 ##关于manage.run()的运行参数引用 >运行hello.py,会显示一个用法消息: -``` -$python hello.py +```$python hello.py usage: hello.py [-h] {shell,runserver}... - positional arguments: -{shell, runserver} +{shell, runserver}``` + shell >在Flask应用上下文中运行Python shell runserver >运行Flask开发服务器:app.run() -optional arguments: --h, --help >显示帮助信息并退出 -``` +```optional arguments: +-h, --help >显示帮助信息并退出``` + >shell命令用于在程序的上下文中启动Python shell会话。可以使用这个会话运行维护任务或测试、调试异常。 >runserver命令用来启动web服务器,运行 python pyfile.py runserver将以调试模式启动web服务器,以下还有其他选项可用: -''' -(venv) $ python pyfile.py runserver --help +'''(venv) $ python pyfile.py runserver --help usage: pyfile.py runserver [-h] [-t HOST] [-p PORT] [--threaded] [--processes PROCESSES] [--passthrough-errors] [-d] - [-r] -''' + [-r]''' + >examples -''' -python pyfile.py runserver --host 0.0.0.0 --port 9000 +'''python pyfile.py runserver --host 0.0.0.0 --port 9000 * Running on http://0.0.0.0:9000/ -* Restarting with reload -''' +* Restarting with reload''' + ======== >>>>>>> cc1796ed8b7e2f74839b21d883acf8dc9c13e1f1 From 2e556e59fdd66885fbd1b7731ec04b533df9d3c2 Mon Sep 17 00:00:00 2001 From: isbasic Date: Sat, 23 May 2015 21:20:08 +0800 Subject: [PATCH 6/7] change some label --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9e8b7bc..af358c0 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,12 @@ ##关于manage.run()的运行参数引用 >运行hello.py,会显示一个用法消息: ```$python hello.py -usage: hello.py [-h] {shell,runserver}... -positional arguments: -{shell, runserver}``` +usage: hello.py [-h] {shell,runserver}...``` -shell >在Flask应用上下文中运行Python shell -runserver >运行Flask开发服务器:app.run() +>positional arguments: +>{shell, runserver} +>shell >在Flask应用上下文中运行Python shell +>runserver >运行Flask开发服务器:app.run()``` ```optional arguments: -h, --help >显示帮助信息并退出``` From 8e401915e7d1addd0140924cbbb8f7bbf04ff5c2 Mon Sep 17 00:00:00 2001 From: isbasic Date: Sat, 23 May 2015 21:22:42 +0800 Subject: [PATCH 7/7] change some label --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index af358c0..c0d017f 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,16 @@ usage: hello.py [-h] {shell,runserver}...``` >shell命令用于在程序的上下文中启动Python shell会话。可以使用这个会话运行维护任务或测试、调试异常。 >runserver命令用来启动web服务器,运行 python pyfile.py runserver将以调试模式启动web服务器,以下还有其他选项可用: -'''(venv) $ python pyfile.py runserver --help + +```(venv) $ python pyfile.py runserver --help usage: pyfile.py runserver [-h] [-t HOST] [-p PORT] [--threaded] [--processes PROCESSES] [--passthrough-errors] [-d] - [-r]''' + [-r]``` >examples -'''python pyfile.py runserver --host 0.0.0.0 --port 9000 +```python pyfile.py runserver --host 0.0.0.0 --port 9000 * Running on http://0.0.0.0:9000/ -* Restarting with reload''' +* Restarting with reload``` ========