Hallo, ich mit einem YouTube video eine kleine FastApi App geschrieben. Dann habe ich sie als ein Docker gebaut. Wenn ich diesen nun starte bekomme ich die im Titel stehende Fehlermeldung. `Ich habe schon ganz Google nach einer Möglichkeit durchgesucht aber leider keine Lösung gefunden. Vll. hat ja einer von euch 'ne Idee.
DER CODE:
from fastapi import FastAPI
from app.model.test import Upscale
app = FastAPI()
class TextIn(Upscale):
org_url: str
class TextOut(Upscale):
url: str
@app.get("/")
def home():
return {"health_check": "OK"}
@app.post("/post", response_model=TextOut)
def UpSc(payload: TextIn):
textwrap = Upscale(payload.org_url)
return {"url": "url"}
`
KOMPLETTER TRACEBACK: `
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.9/site-packages/uvicorn/workers.py", line 66, in init_process
super(UvicornWorker, self).init_process()
File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/app/app/main.py", line 6, in <module>
class TextIn(Upscale):
TypeError: function() argument 'code' must be code, not str
in meinen requirements.txt steht:
fastapi
boto3
opencv-contrib-python-headless
opencv-python-headless
numpy
ich nutzte Python 3.9 habe es aber auch ohne Erfolg mit anderen Version probiert.