Skip to content

Commit 05b0cf1

Browse files
committed
style:格式化代码
1 parent 90329d0 commit 05b0cf1

7 files changed

Lines changed: 15 additions & 10 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,5 @@ flask run
200200
- [ ] 新增 `websocket`模块
201201
- [ ] 七牛 文件上传支持
202202
- [ ] 启用插件机制
203-
- [ ] 限流限频 功能
204203
- [ ] 图形验证码
205204
- [ ] 优化核心库逻辑

app/api/v1/book.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
from app.model.v1.book import Book
1717
from app.validator.schema import (
1818
AuthorizationSchema,
19-
BookSchemaList,
20-
BookQuerySearchSchema,
2119
BookInSchema,
2220
BookOutSchema,
21+
BookQuerySearchSchema,
22+
BookSchemaList,
2323
)
2424

2525
book_api = Redprint("book")

app/config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

app/extension/file/local_uploader.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff 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())

app/validator/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ class BookInSchema(BaseModel):
7171
image: str
7272
summary: str
7373

74+
7475
class BookOutSchema(BaseModel):
7576
id: int
7677
title: str
7778
author: str
7879
image: str
7980
summary: str
8081

82+
8183
class BookSchemaList(BaseModel):
8284
__root__: List[BookOutSchema]
8385

gunicorn.conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import os
2+
23
from gevent import monkey
34

45
monkey.patch_all()
56
import multiprocessing
67

78
bind = "0.0.0.0:5000"
8-
worker_class = 'gevent'
9+
worker_class = "gevent"
910
daemon = False
1011
workers = multiprocessing.cpu_count() * 2 + 1
1112
debug = False

starter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
app.cli.add_command(plugin_cli)
3232

3333
if 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

8889
if __name__ == "__main__":
8990
app.logger.warning(

0 commit comments

Comments
 (0)