@masato17

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

http://127.0.0.1:8000/にアクセスできない

解決したいこと

http://127.0.0.1:8000/ にアクセスしたい

例)
https://github.com/naritotakizawa/django-booking-sample
こちらを参考に、予約管理システムを作っています。
昨日の実装中にエラーが発生しました。
解決方法を教えてください。

発生している問題・エラー

このサイトにアクセスできません
127.0.0.1 で接続が拒否されました。
次をお試しください

接続を確認する
プロキシとファイアウォールを確認する
ERR_CONNECTION_REFUSED

該当するソースコード

!python manage.py runserver

超初心者です。
ご教示ください。

0 likes

1Answer

コンソールで

python manage.py runserver

を実行したとき

Starting development server at http://127.0.0.1:8000/

といった表示は出ますか?

1Like

Comments

  1. @masato17

    Questioner

    このようなコメントが表示されます。

    Watching for file changes with StatReloader
    Performing system checks...

    System check identified some issues:

    WARNINGS:
    booking.Schedule: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
    HINT: Configure the DEFAULT_AUTO_FIELD setting or the BookingConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
    booking.Staff: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
    HINT: Configure the DEFAULT_AUTO_FIELD setting or the BookingConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
    booking.Store: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
    HINT: Configure the DEFAULT_AUTO_FIELD setting or the BookingConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

    System check identified 3 issues (0 silenced).

    You have 1 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): auth.
    Run 'python manage.py migrate' to apply them.
    September 27, 2021 - 19:36:23
    Django version 3.2.7, using settings 'project.settings'
    Starting development server at http://127.0.0.1:8000/
    Quit the server with CONTROL-C.
  2. Starting development server at http://127.0.0.1:8000/
    ちゃんとサーバーは起動できているようですね。
    サーバーを終了させずコンソールをその状態に保ったまま、ブラウザで http://127.0.0.1:8000/ にアクセスしてもエラーが出るわけですか?
  3. @masato17

    Questioner

    現在、google colabで実行しており、
    実行状態にしたままブラウザで開いておりますが、エラーが出ております。
  4. あ、わかりました。
    DjangoのHTTPサーバーはGoogle colabで動いているんですね(動くものなんですね)
    それはローカルマシンのlocalhost (127.0.0.1)ではないので、ローカルマシンのブラウザで http://127.0.0.1:8000/ にアクセスしてもつながりません。

    たぶん、Google colabでDjangoアプリ開発をするのは無理だと思います。
  5. @masato17

    Questioner

    そうなんですね!
    勉強になりました。ありがとうございます!
    別の環境で開発してみます。

Your answer might help someone💌