我有一个用Falcon编写的server.py文件。看起来像这样。
try:
import falcon, logging
from os.path import dirname, realpath, join
from wsgiref import simple_server
from .config.config import server_config
from .middlewares.SQLAlchemySessionManager import SQLAlchemySessionManager
from .middlewares.GlobalInternalServerErrorManager import InternalServerErrorManager
from .lib.dbConnector import Session
from .routes import router
except ImportError as err:
falcon = None
raise err
serv_conf = server_config()
salescoachbot = falcon.API(middleware= [
SQLAlchemySessionManager(Session),
InternalServerErrorManager()
])
但是当我尝试将“ salescoachbot”导入其他文件夹和文件时 喜欢:
from ..server import salescoachbot
这给我一个错误,说
from ..server import salescoachbot
ImportError: cannot import name 'salescoachbot'
server.py位于项目的根目录中,并具有 init .py以及试图导入名称的文件。
我在这里做什么错了?