2013-01-07 1 views
0

해결 방법을 찾을 수 없습니다.Django syncdb AttributeError : 'list'객체에 'startswith'속성이 없습니다.

models.py

class Product(models.Model): 
    prod_id = models.IntegerField(primary_key = True) 
    prod_name = models.CharField(max_length=128) 
    prod_price = models.FloatField() 
    prod_quantity = models.CharField(max_length=75) 
    prod_description = models.TextField() 
    prod_attributes = models.TextField() 
    prod_ingredients = models.TextField() 

settings.py는

INSTALLED_APPS = (
'django.contrib.auth', 
'django.contrib.contenttypes', 
'django.contrib.sessions', 
'django.contrib.sites', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'MyApp', 

이 발생있어 오류입니다 :

Creating tables ... self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Python27\Lib\site-packages\django\core\management\base.py", line 196, in run_from_argv self.execute(*args, **options.dict) File "C:\Python27\Lib\site-packages\django\core\management\base.py", line 232, in execute output = self.handle(*args, **options) File "C:\Python27\Lib\site-packages\django\core\management\base.py", line 371, in handle return self.handle_noargs(**options) File "C:\Python27\Lib\site-packages\django\core\management\commands\syncdb.py", line 91, in handle_noargs sql, references = connection.creation.sql_create_model(model, self.style, seen_models) File "C:\Python27\Lib\site-packages\django\db\backends\creation.py", line 82, in sql_create_model style.SQL_TABLE(qn(opts.db_table)) + ' ('] File "C:\Python27\Lib\site-packages\django\db\backends\mysql\base.py", line 244, in quote_name if name.startswith(" ") and name.endswith(" "): AttributeError: 'list' object has no attribute 'startswith'

그래서 중요한 부분 : AttributeError : '목록' 개체에 'startswith'속성이 없습니다.

아무도 왜이 오류가 발생하는지에 대한 아이디어가 있습니까? 난 다른 것들을 많이 시도하고 그것도 그냥 내 모델 클래스를 만들지 않을 것입니다 그것은 성공적으로 다른 테이블을 만듭니다 작동하지 않습니다. 나는 mysql 데이터베이스를 사용하고있다.

답변

2

역 추적은 db_table 옵션을 잘못 사용했을 가능성이 있음을 나타냅니다. 목록이 아닌 문자열이어야합니다. 사용법을 확인하고 확실하지 않은 경우 더 많은 코드로 질문을 업데이트하십시오.

+0

어떻게 볼 수 있습니까? 당신이 말한대로 db_table 옵션을 잘못 사용했다. 나는 그것을 메타 클래스로 변경했다 : db_table = u'Products 'Thanks Alot Man – Gin