faster-app 0.0.13__tar.gz → 0.0.14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {faster_app-0.0.13 → faster_app-0.0.14}/PKG-INFO +1 -1
  2. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/__init__.py +1 -1
  3. faster_app-0.0.13/faster_app/commands/builtins/fastapi.py → faster_app-0.0.14/faster_app/commands/builtins/server.py +16 -4
  4. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app.egg-info/PKG-INFO +1 -1
  5. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app.egg-info/SOURCES.txt +1 -1
  6. {faster_app-0.0.13 → faster_app-0.0.14}/pyproject.toml +1 -1
  7. {faster_app-0.0.13 → faster_app-0.0.14}/LICENSE +0 -0
  8. {faster_app-0.0.13 → faster_app-0.0.14}/README.md +0 -0
  9. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/.env.example +0 -0
  10. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/base.py +0 -0
  11. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/commands/__init__.py +0 -0
  12. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/commands/base.py +0 -0
  13. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/commands/builtins/__init__.py +0 -0
  14. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/commands/builtins/app.py +0 -0
  15. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/commands/builtins/db.py +0 -0
  16. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/commands/discover.py +0 -0
  17. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/db.py +0 -0
  18. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/main.py +0 -0
  19. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/models/__init__.py +0 -0
  20. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/models/base.py +0 -0
  21. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/models/discover.py +0 -0
  22. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/routes/__init__.py +0 -0
  23. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/routes/base.py +0 -0
  24. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/routes/builtins/__init__.py +0 -0
  25. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/routes/builtins/defaults.py +0 -0
  26. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/routes/builtins/swagger.py +0 -0
  27. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/routes/discover.py +0 -0
  28. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/settings/__init__.py +0 -0
  29. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/settings/builtins/settings.py +0 -0
  30. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/settings/discover.py +0 -0
  31. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/statics/swagger-ui-bundle.min.js +0 -0
  32. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/statics/swagger-ui.min.css +0 -0
  33. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/templates/apps/demo/commands.py +0 -0
  34. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/templates/apps/demo/models.py +0 -0
  35. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/templates/apps/demo/routes.py +0 -0
  36. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app/templates/config/settings.py +0 -0
  37. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app.egg-info/dependency_links.txt +0 -0
  38. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app.egg-info/entry_points.txt +0 -0
  39. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app.egg-info/requires.txt +0 -0
  40. {faster_app-0.0.13 → faster_app-0.0.14}/faster_app.egg-info/top_level.txt +0 -0
  41. {faster_app-0.0.13 → faster_app-0.0.14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: faster_app
3
- Version: 0.0.13
3
+ Version: 0.0.14
4
4
  Summary: 一个轻量级的 Python Web 框架,提供自动发现、模型基类、命令行工具等功能
5
5
  Author-email: peizhenfei <peizhenfei@hotmail.com>
6
6
  Maintainer-email: peizhenfei <peizhenfei@hotmail.com>
@@ -9,7 +9,7 @@ Faster APP - 一个轻量级的 Python Web 框架
9
9
  - 数据库连接管理 (tortoise_init)
10
10
  """
11
11
 
12
- __version__ = "0.0.13"
12
+ __version__ = "0.0.14"
13
13
  __author__ = "peizhenfei"
14
14
  __email__ = "peizhenfei@hotmail.com"
15
15
 
@@ -1,9 +1,11 @@
1
+ import os
2
+ import sys
1
3
  from contextlib import asynccontextmanager
2
4
  from fastapi import FastAPI
3
5
  from tortoise import Tortoise
4
- from faster_app.settings.builtins.settings import DefaultSettings
5
6
  from rich.console import Console
6
7
  from starlette.staticfiles import StaticFiles
8
+ from faster_app.settings import configs
7
9
  from faster_app.commands.base import CommandBase
8
10
  from faster_app.db import tortoise_init
9
11
  import uvicorn
@@ -39,7 +41,6 @@ class FastAPIAppSingleton:
39
41
  def _create_app(cls):
40
42
  """创建FastAPI应用实例"""
41
43
  # 创建FastAPI应用实例
42
- configs = DefaultSettings()
43
44
  app = FastAPI(
44
45
  title=configs.PROJECT_NAME,
45
46
  version=configs.VERSION,
@@ -73,13 +74,24 @@ class ServerOperations(CommandBase):
73
74
  """FastAPI Server Operations"""
74
75
 
75
76
  def __init__(self, host: str = None, port: int = None):
76
- configs = DefaultSettings()
77
77
  self.host = host or configs.HOST
78
78
  self.port = port or configs.PORT
79
79
  self.configs = configs
80
80
 
81
81
  def start(self):
82
- # 启动服务
82
+ """start fastapi server"""
83
+ # 将当前工作目录添加到 Python 路径,确保可以导入项目模块
84
+ current_dir = os.getcwd()
85
+ if current_dir not in sys.path:
86
+ sys.path.insert(0, current_dir)
87
+
88
+ # 设置 PYTHONPATH 环境变量,确保子进程也能找到项目模块
89
+ pythonpath = os.environ.get("PYTHONPATH", "")
90
+ if current_dir not in pythonpath:
91
+ os.environ["PYTHONPATH"] = (
92
+ current_dir + ":" + pythonpath if pythonpath else current_dir
93
+ )
94
+
83
95
  reload = True if self.configs.DEBUG else False
84
96
  uvicorn.run(
85
97
  "faster_app.commands.builtins.fastapi:app",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: faster_app
3
- Version: 0.0.13
3
+ Version: 0.0.14
4
4
  Summary: 一个轻量级的 Python Web 框架,提供自动发现、模型基类、命令行工具等功能
5
5
  Author-email: peizhenfei <peizhenfei@hotmail.com>
6
6
  Maintainer-email: peizhenfei <peizhenfei@hotmail.com>
@@ -18,7 +18,7 @@ faster_app/commands/discover.py
18
18
  faster_app/commands/builtins/__init__.py
19
19
  faster_app/commands/builtins/app.py
20
20
  faster_app/commands/builtins/db.py
21
- faster_app/commands/builtins/fastapi.py
21
+ faster_app/commands/builtins/server.py
22
22
  faster_app/models/__init__.py
23
23
  faster_app/models/base.py
24
24
  faster_app/models/discover.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "faster_app"
7
- version = "0.0.13"
7
+ version = "0.0.14"
8
8
  description = "一个轻量级的 Python Web 框架,提供自动发现、模型基类、命令行工具等功能"
9
9
  readme = "README.md"
10
10
  license = "MIT"
File without changes
File without changes
File without changes