差分
このページの2つのバージョン間の差分を表示します。
| 次のリビジョン | 前のリビジョン | ||
| python:django:runserver [2015/08/20 12:50] – 作成 ともやん | python:django:runserver [2020/12/16 06:38] (現在) – [外部にフルオープンな開発サーバーの起動] ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ====== 開発用サーバの起動 (runserver) ====== | + | < | 
| - | プロジェクトが正常に作成されると開発用サーバを起動して http:// | + | < | 
| + | #result pre, #mincode pre { | ||
| + | /*height: 300px;*/ | ||
| + | overflow: scroll; | ||
| + | overflow-x: hidden; | ||
| + | font-size: 10px; | ||
| + | } | ||
| + | #mintbl table { | ||
| + | font-size: 12px; | ||
| + | } | ||
| + | .dokuwiki .plugin_wrap table { | ||
| + | width: auto; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | ====== 開発用サーバの起動 (manage.py | ||
| + | プロジェクトが正常に作成されると開発用サーバを起動して http:// | ||
| < | < | ||
| $ cd django_project | $ cd django_project | ||
| $ python manage.py runserver | $ python manage.py runserver | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Watching for file changes with StatReloader | ||
| Performing system checks... | Performing system checks... | ||
| System check identified no issues (0 silenced). | System check identified no issues (0 silenced). | ||
| - | You have unapplied | + | You have 17 unapplied | 
| Run ' | Run ' | ||
| - | + | March 29, 2020 - 16:19:35 | |
| - | July 20, 2015 - 16:36:19 | + | Django version | 
| - | Django version | + | |
| Starting development server at http:// | Starting development server at http:// | ||
| - | Quit the server with CONTROL-C. | + | Quit the server with CTRL-BREAK. | 
| </ | </ | ||
| + | </ | ||
| http:// | http:// | ||
| - | {{:python:django_run_devserver.png?640|Django開発サーバ}}\\ | + | {{:python:django: | 
| **メモ: 開発用サーバのポートを変更するには、コマンドを以下のようにする。** | **メモ: 開発用サーバのポートを変更するには、コマンドを以下のようにする。** | ||
| 行 23: | 行 43: | ||
| $ python manage.py runserver 8080 | $ python manage.py runserver 8080 | ||
| </ | </ | ||
| + | |||
| + | ===== 外部にフルオープンな開発サーバーの起動 ===== | ||
| + | **settings.py** にてすべてのクライアント **Host:** ヘッダーを許可するように設定する。\\ | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | $ cd django_project | ||
| + | $ vi django_project/ | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP prewrap 100% # | ||
| + | <code python django_project/ | ||
| + | ALLOWED_HOSTS = [' | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | 開発サーバーを **0.0.0.0: | ||
| + | <WRAP prewrap 100%> | ||
| + | < | ||
| + | $ python manage.py runserver 0.0.0.0: | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | Watching for file changes with StatReloader | ||
| + | Performing system checks... | ||
| + | |||
| + | System check identified no issues (0 silenced). | ||
| + | December 16, 2020 - 06:37:23 | ||
| + | Django version 3.1.4, using settings ' | ||
| + | Starting development server at http:// | ||
| + | Quit the server with CONTROL-C. | ||
| + | </ | ||
| + | </ | ||