コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 6 of about 6 for port (0.002 sec.)
Behind a Proxy 12082
Behind a Proxy Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some situations, you might need to use a proxy server like Traefik or Nginx with a configuration ... ly be served at /api/v1/app . Even though all your code is written assuming there's just /app . Python 3.8+ from fastapi import FastAPI , Request app = FastAPI () @app . get ( "/app" ) def read_main ( request : Request ): return { "message" : "Hello ... art of the ASGI spec). Here we are including it in the message just for demonstration purposes. Python 3.8+ from fastapi import FastAPI , Request app = FastAPI () @app . get ( "/app" ) def read_main ( request : Request ): return { "message" : "Hello ... --root-path or equivalent, you can set the root_path parameter when creating your FastAPI app: Python 3.8+ from fastapi import FastAPI , Request app = FastAPI ( root_path = "/api/v1" ) @app . get ( "/app" ) def read_main ( request : Request ): retur ...
https://man.mtool.work/fastapi/0.115/advanced/behind-a-proxy/
デバッグ 11059
デバッグ Visual Studio CodeやPyCharmなどを使用して、エディター上でデバッガーと連携できます。 uvicorn の実行 FastAPIアプリケーション上で、 uvicorn を直接インポートして実行します: Python 3.8+ import uvicorn from fastapi import FastAPI app = F ... (): a = "a" b = "b" + a return { "hello world" : b } if __name__ == "__main__" : uvicorn . run ( app , host = "0.0.0.0" , port = 8000 ) __name__ == "__main__" について __name__ == "__main__" の主な目的は、ファイルが次のコマンドで呼び出されたときに実 ... 意することです: $ python myapp.py ただし、次のように、別のファイルからインポートされるときには呼び出されません: from myapp import app より詳しい説明 ファイルの名前が myapp.py だとします。 以下の様に実行する場合: $ python myapp.py Pythonによって自動的に ... イル内の内部変数 __name__ は、値として文字列 "__main__" を持ちます。 なので、以下: uvicorn . run ( app , host = "0.0.0.0" , port = 8000 ) は実行されます。 そのモジュール (ファイル) をインポートした場合は、こうはなりません。 したがって、次のようなもう一 ...
https://man.mtool.work/fastapi/0.115/tutorial/debugging/
コンテナ内のFastAPI - Docker 8993
コンテナ内のFastAPI - Docker FastAPIアプリケーションをデプロイする場合、一般的なアプローチは Linuxコンテナ・イメージ をビルドすることです。 基本的には Docker を用いて行われます。生成されたコンテナ・イメージは、いくつかの方法のいずれかでデプ ... -dir --upgrade -r /code/requirements.txt COPY ./app /code/app CMD [ "uvicorn" , "app.main:app" , "--host" , "0.0.0.0" , "--port" , "80" ] # If running behind a proxy like Nginx or Traefik add --proxy-headers # CMD ["uvicorn", "app.main:app", "--host" ... , "0.0.0.0", "--port", "80", "--proxy-headers"] コンテナとは何か コンテナ(主にLinuxコンテナ)は、同じシステム内の他のコンテナ(他のアプリケーシ ... p ディレクトリを作成し、その中に入ります 空のファイル __init__.py を作成します main.py ファイルを作成します: from typing import Union from fastapi import FastAPI app = FastAPI () @app . get ( "/" ) def read_root (): return { "Hello" : "World" } @app ...
https://man.mtool.work/fastapi/0.115/deployment/docker/
Development - Contributing 7713
Development - Contributing Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . First, you might want to see the basic ways to help FastAPI and get help . Developing If ... dependencies and your local FastAPI in your local environment. Using your local FastAPI If you create a Python file that imports and uses FastAPI, and run it with the Python from your local environment, it will use your cloned local FastAPI source co ... ript that you can run that will format and clean all your code: $ bash scripts/format.sh It will also auto-sort all your imports. Tests There is a script that you can run locally to test all the code and generate coverage reports in HTML: $ bash scri ... r: green;">INFO</span>: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) as Uvicorn by default will use the port 8000 , the documentation on port 8008 won't clash. Translations Help with translations is VERY MUCH appreciated! And it ca ...
https://man.mtool.work/fastapi/0.115/contributing/
手動デプロイ 7457
手動デプロイ FastAPI を手動でデプロイすることもできます。 以下の様なASGI対応のサーバをインストールする必要があります: Uvicorn Uvicorn , uvloopとhttptoolsを基にした高速なASGIサーバ。 $ pip install "uvicorn[standard]" ---> 100% 豆知識 standar ... て下さい。ただし、以下の様に --reload オプションは使用しないで下さい: Uvicorn Hypercorn $ uvicorn main:app --host 0 .0.0.0 --port 80 <span style="color: green;">INFO</span>: Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit) $ hypercorn main:a ...
https://man.mtool.work/fastapi/0.115/deployment/manually/
Server Workers - Gunicorn と Uvicorn 7457
Server Workers - Gunicorn と Uvicorn 前回のデプロイメントのコンセプトを振り返ってみましょう: セキュリティ - HTTPS 起動時の実行 再起動 レプリケーション(実行中のプロセス数) メモリ 開始前の事前ステップ ここまでのドキュメントのチュートリアルで ... モジュール、つまりファイル main.py を意味します。そして app は FastAPI アプリケーションの変数名です。 main:app はPythonの import`文と同じようなものだと想像できます: from main import app つまり、 main:app のコロンは、 from main import app のPythonの im ... ワーカー・プロセスで使用するGunicorn互換のワーカークラスです。 ここではGunicornがインポートして使用できるクラスを渡します: import uvicorn.workers.UvicornWorker --bind : GunicornにリッスンするIPとポートを伝えます。コロン( : )でIPとポートを区切ります。 U ... vicornを直接実行している場合は、 --bind 0.0.0.0:80 (Gunicornのオプション)の代わりに、 --host 0.0.0.0 と --port 80 を使います。 出力では、各プロセスの PID (プロセスID)が表示されているのがわかります(単なる数字です)。 以下の通りです ...
https://man.mtool.work/fastapi/0.115/deployment/server-workers/
PREV 1 NEXT