首页 > 解决方案 > Django 没有应用新的修改

问题描述

我部署了我的 Django 应用程序,然后我编辑了源代码,但我的编辑没有应用。

例子:

class Type(models.Model):
    seller          = models.ForeignKey(Profile, related_name="cam_seller_profile", on_delete=models.CASCADE)
    label           = models.CharField(max_length=150, null=True, blank=True)
    slug            = models.SlugField(max_length=255, unique=True, blank=True)

    def __str__(self):
        return "test"

新的更新:

    def __str__(self):
        return self.seller.user.username

结果还是和老一样

在此处输入图像描述

我试过这个来重新加载 nginx 但没有用:

service nginx reload
sudo systemctl restart nginx
sudo systemctl daemon-reload

标签: djangodeployment

解决方案


通过重新加载主管解决的问题

supervisorctl restart myproject

来源:https ://rahmonov.me/posts/run-a-django-app-with-nginx-gunicorn-and-supervisor/


推荐阅读