DatabaseError python manage.py syncdb
我正在学习django框架,在启动syncdb时,我遇到了django问题 请帮助我,如何纠正错误 旧文件 设置.pyDatabaseError python manage.py syncdb,python,mysql,django,Python,Mysql,Django,我正在学习django框架,在启动syncdb时,我遇到了django问题 请帮助我,如何纠正错误 旧文件 设置.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'djangodb1', 'USER': 'root', 'PASSWORD': 'toor', '
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'djangodb1',
'USER': 'root',
'PASSWORD': 'toor',
'HOST': '',
'PORT': '',
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
url.py
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'testsite.views.home', name='home'),
# url(r'^testsite/', include('testsite.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
作为@karthikr上面评论的扩展,它已经“修复”并关闭了——尽管您会注意到该修复只是文档中的一个更改,它承认了将Django移植到Python 3的问题 此时,您有两个现实的选项:
这可能是相关的:如何更改数据库的可能重复?我使用django 1.5和python 3.2
root@lhackg:~/testsite# python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
DatabaseError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s AND `django_content_type`.`app_label` = %s )' at line 1")