在 CentOS 8 上用 Postgres、Nginx 和 Gunicorn 配置 Django 后,无论我如何更改 Django,都没有变化
After configure Django with Postgres, Nginx, and Gunicorn on CentOS 8,no matter how i change the Django ,there has no change
最近我配置web服务器作为这个link的向导:
我可以正常访问主页,如:
the normal page
我可以正常访问 domain_name/admin .
之后,当我创建 my_apps 时,我什至将 url 更改为:
from django.conf.urls import url,include
from django.contrib import admin
urlpatterns = [
]
一旦我访问domain_name或domain_name/admin或IP/admin,就没有change.There没有警告也没有变化
您需要在每次更改后重新启动 gunicorn
,因为自动重新加载只发生在您是 运行 开发服务器,manage.py runserver
。
如果您不想在每次更改后手动重启 gunicorn
,您可以在设置中使用 reload
,但请记住:
This setting is intended for development. It will cause workers to be
restarted whenever application code changes.
The reloader is incompatible with application preloading. When using a
paste configuration be sure that the server block does not import any
application code or the reload will not work as designed.
如前所述,您每次都需要自动重启 gunicorn。
你也可以考虑使用Supervisor或者Monit来自动重启gunicorn,我有这样的Flask应用经验。
看看here几个例子,也许它们会对你有所帮助。
最近我配置web服务器作为这个link的向导:
我可以正常访问主页,如: the normal page 我可以正常访问 domain_name/admin .
之后,当我创建 my_apps 时,我什至将 url 更改为:
from django.conf.urls import url,include
from django.contrib import admin
urlpatterns = [
]
一旦我访问domain_name或domain_name/admin或IP/admin,就没有change.There没有警告也没有变化
您需要在每次更改后重新启动 gunicorn
,因为自动重新加载只发生在您是 运行 开发服务器,manage.py runserver
。
如果您不想在每次更改后手动重启 gunicorn
,您可以在设置中使用 reload
,但请记住:
This setting is intended for development. It will cause workers to be restarted whenever application code changes.
The reloader is incompatible with application preloading. When using a paste configuration be sure that the server block does not import any application code or the reload will not work as designed.
如前所述,您每次都需要自动重启 gunicorn。
你也可以考虑使用Supervisor或者Monit来自动重启gunicorn,我有这样的Flask应用经验。
看看here几个例子,也许它们会对你有所帮助。