File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,6 +200,5 @@ flask run
200200- [ ] 新增 ` websocket ` 模块
201201- [ ] 七牛 文件上传支持
202202- [ ] 启用插件机制
203- - [ ] 限流限频 功能
204203- [ ] 图形验证码
205204- [ ] 优化核心库逻辑
Original file line number Diff line number Diff line change 1616from app .model .v1 .book import Book
1717from app .validator .schema import (
1818 AuthorizationSchema ,
19- BookSchemaList ,
20- BookQuerySearchSchema ,
2119 BookInSchema ,
2220 BookOutSchema ,
21+ BookQuerySearchSchema ,
22+ BookSchemaList ,
2323)
2424
2525book_api = Redprint ("book" )
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class BaseConfig(object):
1616
1717 # 指定加密KEY
1818 SECRET_KEY = os .getenv ("SECRET_KEY" , "https://github.com/TaleLin/lin-cms-flask" )
19-
19+
2020 # 指定访问api服务的url, 用于文件上传
2121 # SITE_DOMAIN="https://lincms.example.com"
2222
Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ class LocalUploader(Uploader):
1111 def upload (self ):
1212 ret = []
1313 self .mkdir_if_not_exists ()
14- site_domain = (
15- current_app .config .get ("SITE_DOMAIN" )
16- if current_app .config .get ("SITE_DOMAIN" )
17- else "http://127.0.0.1:5000"
14+ site_domain = current_app .config .get (
15+ "SITE_DOMAIN" ,
16+ "http://{host}:{port}" .format (
17+ host = current_app .config .get ("FLASK_RUN_HOST" , "127.0.0.1" ),
18+ port = current_app .config .get ("FLASK_RUN_PORT" , "5000" ),
19+ ),
1820 )
1921 for single in self ._file_storage :
2022 file_md5 = self ._generate_md5 (single .read ())
Original file line number Diff line number Diff line change @@ -71,13 +71,15 @@ class BookInSchema(BaseModel):
7171 image : str
7272 summary : str
7373
74+
7475class BookOutSchema (BaseModel ):
7576 id : int
7677 title : str
7778 author : str
7879 image : str
7980 summary : str
8081
82+
8183class BookSchemaList (BaseModel ):
8284 __root__ : List [BookOutSchema ]
8385
Original file line number Diff line number Diff line change 11import os
2+
23from gevent import monkey
34
45monkey .patch_all ()
56import multiprocessing
67
78bind = "0.0.0.0:5000"
8- worker_class = ' gevent'
9+ worker_class = " gevent"
910daemon = False
1011workers = multiprocessing .cpu_count () * 2 + 1
1112debug = False
Original file line number Diff line number Diff line change 3131app .cli .add_command (plugin_cli )
3232
3333if app .config .get ("ENV" ) != "production" :
34+
3435 @app .route ("/" )
3536 def slogan ():
3637 return """
@@ -83,7 +84,7 @@ def slogan():
8384 </p>
8485 </div>
8586 """
86-
87+
8788
8889if __name__ == "__main__" :
8990 app .logger .warning (
You can’t perform that action at this time.
0 commit comments