文書の表示以前のリビジョンバックリンク文書の先頭へ この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。 <html> <style> #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; } </style> </html> ====== 開発用サーバの起動 (manage.py runserver) ====== プロジェクトが正常に作成されると開発用サーバを起動して http://127.0.0.1:8000/ にアクセスすることで「The install worked successfully! Congratulations!」のページを表示することができる。 <code> $ cd django_project $ python manage.py runserver </code> <WRAP prewrap 100% #result> <code> Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. March 29, 2020 - 16:19:35 Django version 3.0.4, using settings 'django_project.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. </code> </WRAP> http://127.0.0.1:8000/にアクセスした様子。\\ {{:python:django:django_3.0_runserver.png?558|Django開発サーバ}}\\ **メモ: 開発用サーバのポートを変更するには、コマンドを以下のようにする。** <code> $ python manage.py runserver 8080 </code> ===== 外部にフルオープンな開発サーバーの起動 ===== **settings.py** にてすべてのクライアント **Host:** ヘッダーを許可するように設定する。\\ <WRAP prewrap 100%> <code> $ cd django_project $ vi django_project/settings.py </code> </WRAP> <WRAP prewrap 100% #mincode> <code python django_project/settings.py> ALLOWED_HOSTS = ['*'] </code> </WRAP> 開発サーバーを **0.0.0.0:8000** で起動する。\\ <WRAP prewrap 100%> <code> $ python manage.py runserver 0.0.0.0:8000 </code> </WRAP> <WRAP prewrap 100% #result> <code> 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 'django_project.settings' Starting development server at http://0.0.0.0:8000/ Quit the server with CONTROL-C. </code> </WRAP> python/django/runserver.txt 最終更新: 2020/12/16 06:38by ともやん