runserverで開発サーバーを起動する
localhost:8000を起動してロケットのページを表示します
「runserverで開発サーバーを起動する」はCoddyKit上の無料Django Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDjango Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Django Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Start the Dev Server
Django includes a lightweight development server. The runserver command launches your app locally so you can see it in a browser. 🚀
python manage.py runserverVisit localhost:8000
By default the server listens on localhost:8000. Open that address in your browser to reach your running project.
The Rocket Page
A fresh project greets you with a friendly rocket page. Seeing it means your install and project are working correctly. 🎉
Auto Reload on Save
The server watches your files and restarts on changes. This auto-reload means you rarely have to stop and start it manually.
Change the Port
Port 8000 busy? Pass a different number to runserver. The new port lets you run several projects side by side.
python manage.py runserver 8080Bind to All Interfaces
To reach the server from another device, bind to 0.0.0.0. Now your phone on the same network can load the page.
python manage.py runserver 0.0.0.0:8000Stop the Server
Done for now? Press Ctrl+C in the terminal to stop the server cleanly and return to your shell.
Read the Console Output
The terminal logs every request with its status code, like a 200 for success. This live log is your first debugging tool.
The Migrations Warning
On first run you may see an unapplied migrations warning. It is harmless now and just reminds you to set up the database soon.
Development Only
This server is for coding, not real traffic. In production you swap to a production server like Gunicorn, which you will meet later.
Run It From the Right Folder
Always launch runserver from the folder containing manage.py. Run it elsewhere and Django cannot find your project.
Quick Check
Let's confirm how runserver behaves.
Recap
You launched runserver, saw the rocket page, changed ports, and learned it is for development only. Your first app is live locally! 🎉
よくある質問
「runserverで開発サーバーを起動する」レッスンは無料ですか?
はい。「runserverで開発サーバーを起動する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Django Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Django Academyコースには全4レッスンが含まれています。
「runserverで開発サーバーを起動する」で何を学びますか?
localhost:8000を起動してロケットのページを表示します ブラウザで直接実行するハンズオンコードでDjango Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Django Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのDjango Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「runserverで開発サーバーを起動する」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このDjango Academyレッスンでコードを書いて実行できますか?
はい。すべてのDjango Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- venvによる仮想環境
- pip install djangoとバージョン固定
- django-admin startprojectを理解する
- runserverで開発サーバーを起動する