即使是枪支在本地运行良好,我面对内部服务器错误

发布于 2025-01-25 17:59:11 字数 2020 浏览 2 评论 0原文

这是我第一次在Django部署进行生产。

我测试了它是否可以通过运行以下命令来服务我的Django应用程序,没有问题,我可以通过服务器IP Adress到达我的网站。

gunicorn hello.wsgi:application --bind 0.0.0.0:8000

application --bind 0.0.0.0:8000
[2022-05-01 11:00:46 +0000] [26484] [INFO] Starting gunicorn 20.1.0
[2022-05-01 11:00:46 +0000] [26484] [INFO] Listening at: http://0.0.0.0:8000 (26484)
[2022-05-01 11:00:46 +0000] [26484] [INFO] Using worker: sync
[2022-05-01 11:00:46 +0000] [26486] [INFO] Booting worker with pid: 26486
/home/scknylmz35/PersonelBlog/home/views.py:24: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'home.models.Blog'> QuerySet.

然后我遵循了以下命令:

sudo nano /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=baris
Group=www-data
WorkingDirectory=/home/baris/eventhub
ExecStart=/home/baris/eventhub/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/baris/eventhub/eventhub.sock eventhub.wsgi:application

[Install]
WantedBy=multi-user.target
sudo systemctl start gunicorn
sudo systemctl enable gunicorn

我测试了枪支,

>> sudo systemctl status gunicorn

 Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor pres>
     Active: active (running) since Sun 2022-05-01 08:01:47 UTC; 2h 19min ago
   Main PID: 23885 (gunicorn)
      Tasks: 4 (limit: 1132)
     Memory: 136.3M
     CGroup: /system.slice/gunicorn.service
             ├─23885 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>
             ├─23897 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>
             ├─23898 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>
             └─23899 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>

这似乎效果很好。但是,当我尝试以mysite的形式到达我的站点时,我也会在检查NGINX错误日志时面对“内部服务器错误”

时,没有错误。

我如何找到问题在哪里?你能指导我吗?

This is my first deploy in Django for production.

I tested whether it can serve my Django application by running the following command and there is no problem I can reach my site by my server ip adress.

gunicorn hello.wsgi:application --bind 0.0.0.0:8000

application --bind 0.0.0.0:8000
[2022-05-01 11:00:46 +0000] [26484] [INFO] Starting gunicorn 20.1.0
[2022-05-01 11:00:46 +0000] [26484] [INFO] Listening at: http://0.0.0.0:8000 (26484)
[2022-05-01 11:00:46 +0000] [26484] [INFO] Using worker: sync
[2022-05-01 11:00:46 +0000] [26486] [INFO] Booting worker with pid: 26486
/home/scknylmz35/PersonelBlog/home/views.py:24: UnorderedObjectListWarning: Pagination may yield inconsistent results with an unordered object_list: <class 'home.models.Blog'> QuerySet.

Then I followed following commands:

sudo nano /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=baris
Group=www-data
WorkingDirectory=/home/baris/eventhub
ExecStart=/home/baris/eventhub/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/baris/eventhub/eventhub.sock eventhub.wsgi:application

[Install]
WantedBy=multi-user.target
sudo systemctl start gunicorn
sudo systemctl enable gunicorn

And I tested gunicorn

>> sudo systemctl status gunicorn

 Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor pres>
     Active: active (running) since Sun 2022-05-01 08:01:47 UTC; 2h 19min ago
   Main PID: 23885 (gunicorn)
      Tasks: 4 (limit: 1132)
     Memory: 136.3M
     CGroup: /system.slice/gunicorn.service
             ├─23885 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>
             ├─23897 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>
             ├─23898 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>
             └─23899 /home/scknylmz35/PersonelBlog/venv/bin/python /home/scknyl>

It seems working good. But when I try to reach my site as mysite.me I face with "Internal Server Error"

Also when I check nginx error log, there is no error.

How can I find where is the problem? Could you please guide me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文