In my project I have the following structure:
- apis
- api_1
- api_2
- function_1
- function_2
In function_1.main.py
I have the following:
from flask import Flask
import logging
from ..apis.api_1 import api
APP = Flask(__name__)
admin = api()
@APP.route("/")
def example(request):
user = admin.get_user('username')
return "Hello... %s!" % user['name']
if __name__ == "__main__":
APP.run(host="127.0.0.1", port=8080, debug=True)
Locally, this runs fine. When I go to deploy this file as a GCF, I get the error OperationError: code=3, message=Function failed on loading user code. Error message: Code in file main.py can't be loaded
because of the from ..apis.api_1 import api
import. How can I bundle just the api_1
code when deploying as a GCF?