Gunicornを使ってVPSサーバーからDjangoプロジェクトが起動できない

前提

ローカルで作ったDjangoのプロジェクトをVPSサーバーに保存したあとVPSサーバーからDjangoのプロジェクトを起動する、
というところで引っかかって困っています。

ターミナルで以下を実施しています。

  1. Djangoとgunicornのインストール
  2. settings.pyファイルの設定
  3. Migration等のコマンドの実行

以上を行って、レンタルしたVPSサーバーのアドレスを使ってブラウザにURLを打ち込んだところ、
ブラウザに以下のエラーメッセージが発生しました。

ERROR
The requested URL could not be retrieved
The following error was encountered while trying to retrieve the URL: http://"VPSサーバーのアドレス"/"プロジェクトのpath"/
Connection to "VPSサーバーのアドレス" failed.
The system returned: (110) Connection timed out
The remote host or network may be down. Please try the request again.
Your cache administrator is root.

※Udemyの講座「【徹底的に解説!】Djangoの基礎をマスターして、3つのアプリを作ろう!」で学習しています。
ちなみに、講座がベースとしているウェブはこちらのようです。
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04

実現したいこと

講座では普通にDjangoのプロジェクトがローカルのPCで起動していたように起動できていました。
同じようにVPSサーバーからの起動ができるようにしたいです。

よろしくお願いします。

発生している問題・エラーメッセージ

ERROR The requested URL could not be retrieved The following error was encountered while trying to retrieve the URL: http://"VPSサーバーのアドレス"/"プロジェクトのpath"/ Connection to "VPSサーバーのアドレス" failed. The system returned: (110) Connection timed out The remote host or network may be down. Please try the request again. Your cache administrator is root.

該当のソースコード

Ubuntu

1. Djangoとgunicornのインストール  pip install django gunicorn psycopg2-binary 2. settings.pyファイルの設定  vim ~/todoproject/todoproject/settings.py 3. Migration等のコマンドの実行  manage.py makemigrations  manege.py migrate  manage.py collectstatic  manage.py createsuperuser 4. gunicornが起動するか確かめてみる  sudo ufw allow 8000  gunicorn --bind 0.0.0.0:8000 "プロジェクト名".wsgi

試したこと

ここに問題に対して試したことを記載してください。

補足情報(FW/ツールのバージョンなど)

VPS:さくらのVPS
Ubuntu:Ubuntu 20.04.4 LTS \n \l
IDE:PyCharm 2022.2.1 (Community Edition)

コメントを投稿

0 コメント