2017-09-25 66 views
0

我正在嘗試遷移數據庫,但每次嘗試時都會返回下面的錯誤。我的應用程序名稱是'helloservice',但表格是數據庫'pulse'中的'customer'。我如何告訴Django不要使用helloservice前綴?如果需要,我按照教程here,現在正在嘗試根據自己的需要調整結果。Django遷移返回意外的名稱

django.db.utils.ProgrammingError: (1146, "Table 'pulse.helloservice_customer' doesn't exist") 

回答

0

使用Meta類並設置表名。然後表名只設置客戶。它不使用前綴(應用程序名稱)。然後進行遷移並設置遷移。

class Customer(models.Model): 
    customer_email = models.EmailField() 
    password = models.CharField(max_length=20) 
    ccustomer_first_name = models.CharField(max_length=30) 
    customer_last_name = models.CharField(max_length=30) 

    class Meta: 
     db_table = "customer"