mirror of
https://github.com/fastapi-admin/fastapi-admin.git
synced 2025-08-15 03:04:37 +08:00
fix cli error
This commit is contained in:
@ -4,6 +4,10 @@ ChangeLog
|
|||||||
|
|
||||||
0.2
|
0.2
|
||||||
===
|
===
|
||||||
|
0.2.6
|
||||||
|
-----
|
||||||
|
- Fix createsuperuser error.
|
||||||
|
|
||||||
0.2.5
|
0.2.5
|
||||||
-----
|
-----
|
||||||
- Now there has builtin menus.
|
- Now there has builtin menus.
|
||||||
|
@ -28,8 +28,10 @@ class Logger:
|
|||||||
|
|
||||||
|
|
||||||
def import_obj(path):
|
def import_obj(path):
|
||||||
module_name, class_name = path.rsplit('.', 1)
|
splits = path.split(".")
|
||||||
return getattr(importlib.import_module(module_name), class_name)
|
module = ".".join(splits[:-1])
|
||||||
|
class_name = splits[-1]
|
||||||
|
return getattr(importlib.import_module(module), class_name)
|
||||||
|
|
||||||
|
|
||||||
async def init_tortoise(args):
|
async def init_tortoise(args):
|
||||||
@ -63,7 +65,7 @@ async def register_permissions(args):
|
|||||||
async def createsuperuser(args):
|
async def createsuperuser(args):
|
||||||
await init_tortoise(args)
|
await init_tortoise(args)
|
||||||
|
|
||||||
user_model = import_obj(args.user_model)
|
user_model = Tortoise.apps.get('models').get(args.user_model)
|
||||||
prompt = PromptSession()
|
prompt = PromptSession()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@ -104,6 +106,6 @@ def cli():
|
|||||||
run_async(parse_args.func(parse_args))
|
run_async(parse_args.func(parse_args))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
sys.path.insert(0, ".")
|
sys.path.insert(0, ".")
|
||||||
cli()
|
cli()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "fastapi-admin"
|
name = "fastapi-admin"
|
||||||
version = "0.1.0"
|
version = "0.2.6"
|
||||||
description = "Fast Admin Dashboard based on fastapi and tortoise-orm and rest-admin."
|
description = "Fast Admin Dashboard based on fastapi and tortoise-orm and rest-admin."
|
||||||
authors = ["long2ice <long2ice@prismslight.com>"]
|
authors = ["long2ice <long2ice@prismslight.com>"]
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -34,7 +34,7 @@ setup(
|
|||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
zip_safe=True,
|
zip_safe=True,
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': ['fastapi-admin = fastapi_admin.cli:cli'],
|
'console_scripts': ['fastapi-admin = fastapi_admin.cli:main'],
|
||||||
},
|
},
|
||||||
platforms='any',
|
platforms='any',
|
||||||
keywords=(
|
keywords=(
|
||||||
|
Reference in New Issue
Block a user