mysql session 表,Django:MySQL没有这样的表:aidata.django_session

I'm running Django 1.4 on Windows 7 in Pycharm and I installed WAMP because I need to have my data in a MySQL table.

This is from setting.py

DATABASES = {

'default': {

'ENGINE': 'django.db.backends.mysql',

'NAME': 'aidata',

'USER': 'root'

}

}

From installed_apps I uncommented:

'django.contrib.sessions'

Running manage.py syncdb does not create any tables ( even models) in my mysqldb.

I get the error when trying to acces /admin/

DatabaseError at /admin/

(1146, "Table 'aidata.django_session' doesn't exist")

解决方案

Double check the db credentials

make sure you uncommented this line in your middleware:

MIDDLEWARE_CLASSES = (

....

'django.contrib.sessions.middleware.SessionMiddleware',

)

then try to python manage.py syncdb.

if you are still having issues post any output

EDIT -- NEXT CHECK:

do you have a "django_content_type" table?

if so, does that table have a "session" record?

if so, delete the session record and try to python manage.py syncdb

EDIT -- STEP 3:

now i'm guessing, post up your settings file so i can make meaningful troubleshooting attempts

Stop your server if you have one running

go into your file browser and delete the settings.pyc file

try to python manage.py syncdb

my thought is that a pyc file with the sqlLite info may be cached and not regenerating

EDIT -- STEP 4:

everything in your settings.py look ok to me. try something for me? create a new django project, don't enable the admin or add in your apps i just want to know if from scratch everything in your django install seems to be working

django-admin.py startproject testsite

do the database configuration/setup

python manage.py syncdb

let me know if the models create properly

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值