我有一个这样的目录结构:
python-functions/
--src
---- | api/
-------- | __init__.py
-------- | main.py
---- | __init__.py
---- | main.py
Run Code Online (Sandbox Code Playgroud)
我试图在 src/main.py 中定义所有函数,但在其相应的文件夹中有实现
python-functions/
--src
---- | api/
-------- | __init__.py
-------- | main.py
---- | __init__.py
---- | main.py
Run Code Online (Sandbox Code Playgroud)
# src/main.py
import src.api.main as api
@https_fn.on_request(timeout_sec=300)
def status(req: https_fn.Request) -> https_fn.Response:
return api.status(req)
Run Code Online (Sandbox Code Playgroud)
但是在部署时我收到此错误:
# Importing like: import src
ModuleNotFoundError: No module named 'src'
127.0.0.1 - - [18/May/2023 00:09:43] "GET /\_\_/functions.yaml HTTP/1.1" 500 -
Error: Failed to parse build specification:
- …Run Code Online (Sandbox Code Playgroud) python firebase google-cloud-platform firebase-tools google-cloud-functions