服務器上更改的 HTML 文件未反映 (The HTML file changed on server is not reflected)


問題描述

服務器上更改的 HTML 文件未反映 (The HTML file changed on server is not reflected)

使用 DigitalOcean 部署 django 項目。與服務器IP地址確認後,顯示該站點。不過有一部分是我要修改的,django的template文件夾是我編輯的一些html。而且即使在重新加載後檢查了nginx,也沒有反映出來。但是,因為第一次部署,原因不明。

我想問一下這個原因。這是否意味著顯示的 HTML 不是模板文件夾顯示?我想知道如何解決它。

後記請告訴我。

[Unit]
Description=gunicorn daemon (apasn)
Requires=apasn.socket
After=network.target

[Service]
User=administrator
Group=www‑data
WorkingDirectory=/home/administrator/apasn
ExecStart=/home/administrator/apasn/venv/bin/gunicorn \
‑‑access‑logfile ‑ \
‑‑workers 3 \
‑‑bind unix:/run/gunicorn/apasn.sock \
person_manager.wsgi:application

[Install]
WantedBy=multi‑user.target

參考解法

方法 1:

Django uses a cache with the templates so restarting nginx won't do anything right away. There are a few things that you can do:

First, try restarting gunicorn:

sudo systemctl restart gunicorn

See if that fixes it. If not, switch debug mode on with DEBUG = True in settings.py and then restart gunicorn. You will definitely see the changes at that point. Then, turn debug mode back off with DEBUG = False and then restart gunicorn again.

(by djangoSam Creamer)

參考文件

  1. The HTML file changed on server is not reflected (CC BY‑SA 2.5/3.0/4.0)

#gunicorn #Django #nginx






相關問題

Heroku 無法啟動我的應用程序,但 `foreman start` 工作 (Heroku fails to start my app, but `foreman start` works)

為什麼不再推薦 gunicorn_django ? (Why is gunicorn_django not recommended anymore?)

Supervisord 拋出錯誤:“無法執行 /var/application/gunicorn_start:ENOEXEC” (Supervisord throws error: "couldn't exec /var/application/gunicorn_start: ENOEXEC")

服務器上更改的 HTML 文件未反映 (The HTML file changed on server is not reflected)

在 gae flexible 上長時間運行的雲任務會提前終止而不會出錯。如何調試?我錯過了什麼? (Long running cloud task on gae flexible terminates early without error. How to debug? What am I missing?)

Gunicorn 沒有自動啟動 (Gunicorn not starting automatically)

nginx的配置文件中的主機名未知? (Hostname in configfile of nginx unkown?)

重新啟動 gunicorn 和 nginx 不會反映拉取請求後的更改 (restarting gunicorn and nginx doesn't reflect changes after pull request)

當 gunicorn / celery 服務重新啟動時,Django 中有沒有辦法只執行一次 python 代碼? (Is there a way in Django to execute some python code only once when gunicorn / celery services are getting restarted?)

ModuleNotFoundError:在 Heroku 服務器上使用 Django 和 Gunicorn 時沒有名為“App Name”的模塊 (ModuleNotFoundError: No module named 'App Name' when using Django and Gunicorn on a heroku server)

kubernetes 正在暴露未聲明的端口 (kubernetes is exposing not declared port)

PM2.js 在 Virtualenv/Anaconda 環境中運行 Gunicorn/Flask 應用程序 (PM2.js to Run Gunicorn/Flask App inside Virtualenv/Anaconda env)







留言討論