LoginSignup
2
0

Reflexライブラリのコンフィギュレーションについて

Posted at

お疲れ様です。

今日は「Reflexライブラリのコンフィギュレーションについて」について部分いたします。

英語版は下記ページをご覧ください。
https://reflex.dev/docs/getting-started/configuration/

Reflexアプリは、設定ファイル、環境変数、およびコマンドライン引数を使用して構成できます。

Configuration File

reflex initを実行すると、ルートディレクトリにrxconfig.pyファイルが作成されます。Configクラスにキーワード引数を渡して、アプリを構成できます。

# rxconfig.py
import reflex as rx

config = rx.Config(
    app_name="my_app_name",
    # Connect to your own database.
    db_url="postgresql://user:password@localhost:5432/my_db",
    # Change the frontend port.
    frontend_port=3001,
)

利用可能なすべてのパラメーターに関するconfig referenceを参照してください。

Environment Variables

設定ファイルを上書きするには、環境変数を設定できます。たとえば、frontend_port設定を上書きするには、FRONTEND_PORT環境変数を設定します。

FRONTEND_PORT=3001 reflex run

Command Line Arguments

最後に、reflex runにコマンドライン引数を渡すことで、設定ファイルと環境変数を上書きできます。

reflex run --frontend-port 3001

利用可能なすべての引数に関するCLI referenceを参照してください。

Customizable App Data Directory

REFLEX_DIR環境変数を設定することができます。これにより、ReflexがBunやNodeJSなどのヘルパーツールを書き込む場所をユーザーが設定できます。

デフォルトでは、プラットフォーム固有のディレクトリが使用されます:

Windowsでは、C:/Users/<username>/AppData/Local/reflexが使用されます。

macOSでは、~/Library/Application Support/reflexが使用されます。

Linuxでは、~/.local/share/reflexが使用されます。

今日は以上です。

ありがとうございました。
よろしくお願いいたします。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0