Skip to content

Commit

Permalink
Merge pull request #7 from lewangdev/fastapi
Browse files Browse the repository at this point in the history
remove load sys.path in code
  • Loading branch information
lewangdev authored Dec 20, 2021
2 parents ec2f8a5 + 3ca8480 commit 525c2b2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ pip install -r requirements.txt
3. 运行,项目默认运行在 8080 端口:

``` shell script
python paddlewebocr/main.py [--port=8080]
uvicorn paddlewebocr.main:app --host 0.0.0.0 --port 8080


#或者

uvicorn paddlewebocr.main:app --host 0.0.0.0 --port 8080
PYTHONPATH="${PYTHONPATH}:." python paddlewebocr/main.py [--port=8080]

```

### Docker 部署
Expand Down
5 changes: 0 additions & 5 deletions paddlewebocr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
import sys
import os

MODULE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(MODULE_PATH)
5 changes: 0 additions & 5 deletions paddlewebocr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from starlette.middleware.cors import CORSMiddleware

MODULE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(MODULE_PATH)
from paddlewebocr.pkg.config import settings
from paddlewebocr.pkg.log import InterceptHandler, format_record
from paddlewebocr.route.api import api_router
Expand All @@ -27,8 +24,6 @@ def make_app():
)
logger.add(settings.LOG_FILE, encoding='utf-8', rotation="9:46")

print(logging.root.manager.loggerDict)

loggers = (
logging.getLogger(name)
for name in logging.root.manager.loggerDict
Expand Down

0 comments on commit 525c2b2

Please sign in to comment.