From 9c8034b6d745766d446194f4d2d07dc447bf1fc9 Mon Sep 17 00:00:00 2001 From: neo1218 Date: Fri, 30 Oct 2015 16:29:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 61 ++++++++++++------ .../Test}/README.md | 0 .../Test}/app/__init__.py | 0 .../Test}/app/forms.py | 0 .../Test}/app/views.py | 0 .../Test}/requirement.txt | 0 .../init_project => example/Test2}/README.md | 0 .../Test2}/app/__init__.py | 1 + .../Test2}/app/__init__.pyc | Bin 545 -> 534 bytes example/Test2/app/book/__init__.py | 13 ++++ .../app => example/Test2/app/book}/forms.py | 0 .../app => example/Test2/app/book}/views.py | 0 .../Test2}/app/forms.py | 0 example/Test2/app/forms.pyc | Bin 0 -> 136 bytes .../Test2}/app/models.py | 3 + example/Test2/app/models.pyc | Bin 0 -> 453 bytes .../Test2}/app/share/__init__.py | 0 .../Test2}/app/share/forms.py | 0 .../Test2}/app/share/views.py | 0 .../Test2}/app/views.py | 0 example/Test2/app/views.pyc | Bin 0 -> 136 bytes .../Test2}/config.py | 0 example/Test2/config.pyc | Bin 0 -> 2408 bytes .../Test2}/manage.py | 0 example/Test2/requirement.txt | 2 + examples/init_cfg_project/app/__init__.py | 17 ----- examples/init_cfg_project/config.py | 47 -------------- examples/init_project/requirement.txt | 0 examples/init_sql_config/README.md | 0 examples/init_sql_config/app/forms.pyc | Bin 147 -> 0 bytes examples/init_sql_config/app/models.pyc | Bin 270 -> 0 bytes examples/init_sql_config/app/views.pyc | Bin 147 -> 0 bytes examples/init_sql_config/config.pyc | Bin 2485 -> 0 bytes examples/init_sql_config/requirement.txt | 0 examples/project/README.md | 0 examples/project/app/__init__.py | 15 ----- examples/project/app/__init__.pyc | Bin 395 -> 0 bytes examples/project/app/forms.py | 0 examples/project/app/forms.pyc | Bin 139 -> 0 bytes examples/project/app/views.py | 0 examples/project/app/views.pyc | Bin 139 -> 0 bytes examples/project/manage.py | 47 -------------- examples/project/requirement.txt | 0 test.py | 7 ++ 44 files changed, 69 insertions(+), 144 deletions(-) rename {examples/init_cfg_project => example/Test}/README.md (100%) rename {examples/init_project => example/Test}/app/__init__.py (100%) rename {examples/init_cfg_project => example/Test}/app/forms.py (100%) rename {examples/init_cfg_project => example/Test}/app/views.py (100%) rename {examples/init_cfg_project => example/Test}/requirement.txt (100%) rename {examples/init_project => example/Test2}/README.md (100%) rename {examples/init_sql_config => example/Test2}/app/__init__.py (91%) rename {examples/init_sql_config => example/Test2}/app/__init__.pyc (62%) create mode 100644 example/Test2/app/book/__init__.py rename {examples/init_project/app => example/Test2/app/book}/forms.py (100%) rename {examples/init_project/app => example/Test2/app/book}/views.py (100%) rename {examples/init_sql_config => example/Test2}/app/forms.py (100%) create mode 100644 example/Test2/app/forms.pyc rename {examples/init_sql_config => example/Test2}/app/models.py (79%) create mode 100644 example/Test2/app/models.pyc rename {examples/init_sql_config => example/Test2}/app/share/__init__.py (100%) rename {examples/init_sql_config => example/Test2}/app/share/forms.py (100%) rename {examples/init_sql_config => example/Test2}/app/share/views.py (100%) rename {examples/init_sql_config => example/Test2}/app/views.py (100%) create mode 100644 example/Test2/app/views.pyc rename {examples/init_sql_config => example/Test2}/config.py (100%) create mode 100644 example/Test2/config.pyc rename {examples/init_sql_config => example/Test2}/manage.py (100%) create mode 100644 example/Test2/requirement.txt delete mode 100644 examples/init_cfg_project/app/__init__.py delete mode 100644 examples/init_cfg_project/config.py delete mode 100644 examples/init_project/requirement.txt delete mode 100644 examples/init_sql_config/README.md delete mode 100644 examples/init_sql_config/app/forms.pyc delete mode 100644 examples/init_sql_config/app/models.pyc delete mode 100644 examples/init_sql_config/app/views.pyc delete mode 100644 examples/init_sql_config/config.pyc delete mode 100644 examples/init_sql_config/requirement.txt delete mode 100644 examples/project/README.md delete mode 100644 examples/project/app/__init__.py delete mode 100644 examples/project/app/__init__.pyc delete mode 100644 examples/project/app/forms.py delete mode 100644 examples/project/app/forms.pyc delete mode 100644 examples/project/app/views.py delete mode 100644 examples/project/app/views.pyc delete mode 100644 examples/project/manage.py delete mode 100644 examples/project/requirement.txt create mode 100644 test.py diff --git a/README.md b/README.md index 7e88f91..bbe1710 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,29 @@ mana ## 使用mana: ### 1. mana init --> 构建你的项目 +#### 1. 构建一般项目(无蓝图、无数据库、无配置文件) - ~> mana init my_project + $ mana init my_project -你已经创建了你的目录结构(如图)
+创建的目录结构(如图)
+ + |-app/ ---- __init__.py + |-test/ + my_project - | views.py + |-requirement.txt forms.py + |-README.md templates + | static + +文件中预填代码
+[app/__init__.py预填代码](https://github.com/neo1218/mana/blob/master/examples/GoodIdea/app/__init__.py) : 创建了flask app, 导入了基本配置
+现在你只需开开兴兴的写视图了 + +#### 2. 构建中型项目(无蓝图、有数据库、有配置文件) + + 默认集成的是flask-sqlalchemy数据库扩展🍺 + $ mana init my_project --sql=true + +创建的目录结构(如图)
|-app/ ---- __init__.py |-test/ models.py @@ -26,9 +45,25 @@ mana |-README.md templates | static -并且在相关文件中预填了代码
-[config.py预填代码](https://github.com/neo1218/mana/blob/master/examples/GoodIdea/config.py) : 三个配置类, 对应生产、测试、开发环境配置
+文件中预填代码
[app/__init__.py预填代码](https://github.com/neo1218/mana/blob/master/examples/GoodIdea/app/__init__.py) : 创建了flask app, 导入了基本配置 +[config.py预填代码](): 测试、生产、开发环境下配置 +[models.py预填代码](): 导入 db 对象 + +#### 3. 构建大型项目(有蓝图、有数据库、有配置文件) + + 将mana init与mana blue搭配使用 + +命令如下 + + # 构建项目 + $ mana init my_project --sql=true + + # 自动创建、注册蓝图 + $ mana blue my_project <蓝图名> + +具体见 ~mana blue~ 的用法 + ### 2. mana install (--venv) --> 安装flask扩展 在 requirement.txt 中写入你希望安装的扩展的名称
@@ -50,17 +85,7 @@ ex: 这样你的扩展就会被安装到全局中
不过强烈建议使用使用虚拟环境进行开发,参见[virtualenv](http://docs.jinkan.org/docs/flask/installation.html#virtualenv)
- -### 3. mana sql --> 集成 flask-sqlalchemy 处理关系型数据库 -对于sql数据库的处理, flask-sqlalchemy 是我最常用的扩展,使用mana可以快速集成flask-sqlalchemy并初始化扩展 - - 进入与项目根目录同级的目录 🍺 - $ mana sql project_name - -接下来,你只需要专心于models.py的数据库类设计与编码了
- - -### 4. mana manage --> 使用 manage.py 管理你的项目 +### 3. mana manage --> 使用 manage.py 管理你的项目 还可以使用mana创建manage.py集成flask-script和flask-migrate管理我们的项目 进入与项目根目录同级的目录 🍺 @@ -99,7 +124,7 @@ ex: >> User -### 5. mana blue (--prefix)--> 自动注册蓝图 +### 4. mana blue (--prefix)--> 自动注册蓝图 进入与项目根目录同级的目录 🍺 $ mana blue project_name bluep @@ -111,14 +136,14 @@ ex: 这样就可以通过 /bluep/... 去访问蓝图对应的视图 -### 6. mana deploy --> deploy flask application on wsgi server +### 5. mana deploy --> deploy flask application on wsgi server 进入与项目根目录同级的目录 🍺 $ mana deploy project_name --host=121.43.230.104 --port=2333 这样就可以创建wsgi.py去部署你的flask应用 -### 7. mana what? --> use your imagination .. +### 6. mana what? --> use your imagination .. 未完 .... 待续 .... diff --git a/examples/init_cfg_project/README.md b/example/Test/README.md similarity index 100% rename from examples/init_cfg_project/README.md rename to example/Test/README.md diff --git a/examples/init_project/app/__init__.py b/example/Test/app/__init__.py similarity index 100% rename from examples/init_project/app/__init__.py rename to example/Test/app/__init__.py diff --git a/examples/init_cfg_project/app/forms.py b/example/Test/app/forms.py similarity index 100% rename from examples/init_cfg_project/app/forms.py rename to example/Test/app/forms.py diff --git a/examples/init_cfg_project/app/views.py b/example/Test/app/views.py similarity index 100% rename from examples/init_cfg_project/app/views.py rename to example/Test/app/views.py diff --git a/examples/init_cfg_project/requirement.txt b/example/Test/requirement.txt similarity index 100% rename from examples/init_cfg_project/requirement.txt rename to example/Test/requirement.txt diff --git a/examples/init_project/README.md b/example/Test2/README.md similarity index 100% rename from examples/init_project/README.md rename to example/Test2/README.md diff --git a/examples/init_sql_config/app/__init__.py b/example/Test2/app/__init__.py similarity index 91% rename from examples/init_sql_config/app/__init__.py rename to example/Test2/app/__init__.py index bbdae36..4501dc4 100644 --- a/examples/init_sql_config/app/__init__.py +++ b/example/Test2/app/__init__.py @@ -21,3 +21,4 @@ from . import views, models, forms app.register_blueprint('share', url_prefix='/share') +app.register_blueprint('book') diff --git a/examples/init_sql_config/app/__init__.pyc b/example/Test2/app/__init__.pyc similarity index 62% rename from examples/init_sql_config/app/__init__.pyc rename to example/Test2/app/__init__.pyc index ce9471a204126431cf418f4871f398a7b1873d84..764cad058540e6ace47fffc4b6ba220568f1c18f 100644 GIT binary patch delta 33 pcmZ3;GL40u`7ugr00oRd+5w1*S%5?e14FO|NW@PANHCxg#fCsJ{m|mnqGJ8Tf`Xh> z{fxxqZ2jECyhQ!fio{%yNJwgNi4jOvKP|r~w^*;BvV;Su%O*EJr8Fni4rF#Q5HkP( D5f>ZH literal 0 HcmV?d00001 diff --git a/examples/init_sql_config/app/models.py b/example/Test2/app/models.py similarity index 79% rename from examples/init_sql_config/app/models.py rename to example/Test2/app/models.py index 8eedde3..9f66b15 100644 --- a/examples/init_sql_config/app/models.py +++ b/example/Test2/app/models.py @@ -7,3 +7,6 @@ """ from . import db + +class User(): + pass diff --git a/example/Test2/app/models.pyc b/example/Test2/app/models.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b446cce57e3afb2368637a6129d4b9f60ad31d5 GIT binary patch literal 453 zcmbVIy-EZz5T5Lwt3(7J;mU0^aDtVH_y87rD%>_9ZUTzCcZ-Rjjg5kpmFQ!Lm4%kR zitY>e0)CU#vv**=%ugoseM!GoSIxB)%wQSrd0!^>`e&JFVEJ0xS%uvQsfZ9oar8&v TpSz>FtzOS|{A*sDiPiKQ@b+KW literal 0 HcmV?d00001 diff --git a/examples/init_sql_config/app/share/__init__.py b/example/Test2/app/share/__init__.py similarity index 100% rename from examples/init_sql_config/app/share/__init__.py rename to example/Test2/app/share/__init__.py diff --git a/examples/init_sql_config/app/share/forms.py b/example/Test2/app/share/forms.py similarity index 100% rename from examples/init_sql_config/app/share/forms.py rename to example/Test2/app/share/forms.py diff --git a/examples/init_sql_config/app/share/views.py b/example/Test2/app/share/views.py similarity index 100% rename from examples/init_sql_config/app/share/views.py rename to example/Test2/app/share/views.py diff --git a/examples/init_sql_config/app/views.py b/example/Test2/app/views.py similarity index 100% rename from examples/init_sql_config/app/views.py rename to example/Test2/app/views.py diff --git a/example/Test2/app/views.pyc b/example/Test2/app/views.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9122fa9736b3c3557657b48ce48f07ce0d91e2ad GIT binary patch literal 136 zcmZSn%*)lIU>ugr00oRd+5w1*S%5?e14FO|NW@PANHCxg#fCsJ{m|mnqGJ8Tf`Xh> z{fxxqZ2jECyhQ!fio{%yNJwgNi4jOvzbrGgyjZWGvV;Su%O*EJr8Fni4rF#Q5HkP( D5$hY& literal 0 HcmV?d00001 diff --git a/examples/init_sql_config/config.py b/example/Test2/config.py similarity index 100% rename from examples/init_sql_config/config.py rename to example/Test2/config.py diff --git a/example/Test2/config.pyc b/example/Test2/config.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bf661416927e64d2e6e5287ec29be47025b6b0a0 GIT binary patch literal 2408 zcmb_d&2Jk;6o0!;Y{zk0P$2~&AY70|MJ!R&Lxljx-n15uLuZ{<@nyB$og};X3(q71 z2_d9_IPfJT;Dl6(3kMJt2RO9w-!uuF`2*nnX0wiCQVt<&&)b{ob3*Uvq^| z7cSon=)>9}?{n zt+#U&PLs^h1|N|fY4a53Qf+>uouP0h)fPtD0!91{-Z4v8BrhrQt3cr#zgT&WuC!-i zom+YYMqg%8Sl}n<_co%<#lgE~^nUsj%n%Fy{OGfT-+$Ww=HmzVe=S6R^V8H>-d!~t zkA-6iCtqVBIUMW=OPged;wg%!5gm4Z@Eok*5U{iDJh7$if|0W%i--#%!ZDg7;g+Uw z;CU8%ckbu@h6}pCu(>UjT2Oiz^)>^GC(>5s zzQT!Yms^6iSzc`wqokhYp6fQeTHUQIH5?7+TElIrpT@+EMx{}`?yRhP)zy`iddpjF zdM&3SYOA-J`pM%fgi~D=HSflnBkGQ;i#)5eucM$V^;SO=h|W=HOz#x&5qt{G;cR>$ zYh|q`xbe@{kFugBcVwqO=*pg+AQxOV{a-%$i%VjcpJYkc8WYuT&1V%c+= z$gh~T7!FAp;0l~5Q`m!NE7hRJPsQriJPck97 za=5^nTmV%Sd_MT<&Vzg3Poe<+juG!)d4K{001jgxpme3plv}{4iDHZ1GpT8f)m|(# z6(OlE7@9&CbdtZmXhM5ZGhQHm>NtBFtrsNo(z-P0_zpYG#ftHI3E}z4DXd}YK zlklAtUmPLr diff --git a/examples/init_sql_config/app/models.pyc b/examples/init_sql_config/app/models.pyc deleted file mode 100644 index be128e4eb274d7337ed84379b1a64c6241f0de24..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 270 zcmZSn%**xli&0oI0~9a;X$K%KmI4wf3=B~~l93^Wi6MuPA(x3Eiiv?Sg_$8(g9W6< z3`lS(06}hkN@`BAUO^?8R|f-JU@l0(v#A@N^{#umYx1*c?N4@ZKlC+Fv-Wu}7^>cd@G!T~hF2FNYVNwou6SqyRn8zTUAk3hHp diff --git a/examples/init_sql_config/app/views.pyc b/examples/init_sql_config/app/views.pyc deleted file mode 100644 index 77c2b8aa0442b238b2e45b5c7051a4a55aec59b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmZSn%**xli&0oI0~9atU+^LH diff --git a/examples/init_sql_config/config.pyc b/examples/init_sql_config/config.pyc deleted file mode 100644 index c945a6e88b3d298dade7e69b2bc8cc25d1c9b288..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2485 zcmcIm&u<%55T0Epw&OT0sE~pX5H6L~imn8x5)}d*d(&Dt4t?viiZ4%F?@O|ay=(kl zB9IV53Wx&&gan+BDskZeqT&FD7XF(ifirNXGqYL8F)5dnb$0f>dB0}nn{Qrnf6kTu z{_BP7T{w7h_IkI(Z0k5S)f!3O)qb z0a)u4AeaVKfOXs=KhhQ8b)UnO;g0xJc?_{JZ+-@yK)L84@w#PeI+IPB4s}bwtCbp-~=gyq>F7@lW10{ zcsm>>G26MJj3E2XG>Rp^rhbwUy=N zMq945WZSKZ`pS)#dGhEC;nr3}U0z#tMZ@(>8ArA8P1x-#vzY{f0(BTAZk;St0yl&? zI)={5TY2jVeDPq$m38NxJ z$RFfJ4t8ufi@eBE?Qz^__ty`0KmTI?v)jAh?i?l@k*4lmm-TA9x>)sGxhk5PvJk-! zjk@eO4kv2h8~^!0ZC_0F6>>=s7=o-7L>xgnhOX`|u3ixYxS(_qGc-Vx2fo?lMwEmx z!++D)DhP+>ERK%BIc84d;etXAQ)Xx~nc=Vufz(#oAhR9>g^N>81O*m>G42x}dq02j z`|YnL0io1ryI%W05g{iS5rbA|kPripg@k~hEgP*#P{bKpLo^m-k(ehz=o>oWMte!t zJh3F*7IClsaDgDipT$>GiljhXu=w0JhgdVZCQRZ7p>Y+LOrUY37Qe)lzyi%Yp?l(h z5-C5@>j{f7GlUXYll%K$-nw_^yGcMOtH;vuU+ka?MOYlb(52dzyjYx|Hi0-U| z>uWuv`zj>_4uT*q2ufE$#_>N1>3w*J4!2GQ5ug4_dR@LsR%v2m-Y#3u0BT1?ITFSjflS@p3r(2}#lr^Z) zf7LMf2yNYWtLD+82PKU!Nz5tyCwGRSxN~N70{dDco>aXNbf++{%3{WeVeHqY_EaFG eY`Vrvc{051HqULZpIdWI3mu&j@uOhMX2CCnCsIiO diff --git a/examples/project/app/forms.py b/examples/project/app/forms.py deleted file mode 100644 index e69de29..0000000 diff --git a/examples/project/app/forms.pyc b/examples/project/app/forms.pyc deleted file mode 100644 index 49bcfc345a39e368d958137af04510fb5cdcd321..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 139 zcmZSn%*%D;t5H}o0~9a