0Pricing
Flask Academy · レッスン

デバッグモードで開発サーバーを実行する

flask runを起動し、デバッグを有効にしてリローダーを確認します

「デバッグモードで開発サーバーを実行する」はCoddyKit上の無料Flask Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはFlask Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Flask Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

The Dev Server

Flask includes a built-in development server so you can run your app instantly while building, with no extra setup. 🛠️

Start with flask run

The recommended way to launch is the flask run command, which finds your app and serves it on the local port.

flask run

Tell Flask Your App

Set the FLASK_APP variable so the command knows which file holds your application object.

export FLASK_APP=app.py

The Default Address

By default the server listens on 127.0.0.1:5000, reachable only from your own machine while you develop.

Turn On Debug Mode

Debug mode unlocks two big helpers: a live reloader and a rich error page. Enable it while developing only.

flask run --debug

The Auto Reloader

With debug on, the reloader watches your files and restarts the server whenever you save a change. No manual restarts. ♻️

The Interactive Debugger

When code crashes, debug mode shows a detailed traceback in the browser so you can pinpoint the failing line fast.

Set Debug in Code

You can also flip debug on inside app.run, handy when you launch the file directly with python.

app.run(debug=True)

Reading the Reloader Output

The console prints a line each time it reloads, confirming your edits were picked up and the server is fresh.

Never Debug in Production

The debugger can run arbitrary code, so it is a serious security risk. Keep debug mode off on any public server.

Stop the Server

Press Ctrl+C in the terminal to shut the dev server down cleanly when you are finished working.

Quick Check

Quick check on what debug mode gives you.

Recap

You ran the dev server with flask run, enabled debug for the reloader and debugger, and learned to keep it off in production. 🔒

よくある質問

「デバッグモードで開発サーバーを実行する」レッスンは無料ですか?

はい。「デバッグモードで開発サーバーを実行する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Flask Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Flask Academyコースには全4レッスンが含まれています。

「デバッグモードで開発サーバーを実行する」で何を学びますか?

flask runを起動し、デバッグを有効にしてリローダーを確認します ブラウザで直接実行するハンズオンコードでFlask Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Flask Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのFlask Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「デバッグモードで開発サーバーを実行する」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このFlask Academyレッスンでコードを書いて実行できますか?

はい。すべてのFlask Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. Flaskとは何か、なぜ存在するのか
  2. VirtualenvをセットアップしてFlaskをインストールする
  3. Hello World:初めてのFlaskアプリ
  4. デバッグモードで開発サーバーを実行する
← Flask Academyに戻る