运行“python manage.py sql polls”时没有任何反应

时间:2020-12-12 18:04:11

I am trying to get Django running on Google App Engine using Django non-rel. I am following the Django 1.5 tutorial However, when i run:

我正在尝试使用Django non-rel让Django在Google App Engine上运行。我正在关注Django 1.5教程但是,当我运行时:

python manage.py sql polls

nothing is returned. Can anyone suggest why 'manage.py sql' is silently failing?

没有任何回报。任何人都可以建议为什么'manage.py sql'默默地失败了?

When I sync the database I get:

当我同步数据库时,我得到:

$ python manage.py syncdb
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

The database is specified in settings.py as follows:

数据库在settings.py中指定如下:

# Activate django-dbindexer for the default database
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': DATABASES['default']}
AUTOLOAD_SITECONF = 'indexes'

and I have remembered to include 'polls' in the settings.py

我记得在settings.py中包含'民意调查'

INSTALLED_APPS = (
#    'django.contrib.admin',
    'django.contrib.contenttypes',
    'django.contrib.auth',
    'django.contrib.sessions',
    'djangotoolbox',
    'autoload',
    'dbindexer',
    'polls',

    # djangoappengine should come last, so it can override a few manage.py commands
    'djangoappengine',
)

and the models are present in polls/models.py

并且模型存在于poll / models.py中

from django.db import models

class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)

NOTE: If I change settings.py to use a local sqlite3 database, 'manage.py sql polls' behaves as described in the tutorial. Therefore, as far as I can tell, this has nothing to do with:

注意:如果我将settings.py更改为使用本地sqlite3数据库,则'manage.py sql polls'的行为与教程中所述相同。因此,据我所知,这与以下内容无关:

  1. the /polls directory structure
  2. / polls目录结构

  3. the /polls/models.py file
  4. /polls/models.py文件

  5. the python path
  6. python路径

1 个解决方案

#1


1  

Why do you expect it do anything? GAE is, specifically, a non-relational (NoSQL) datastore. There is quite simply no SQL to produce.

你为什么期望它做任何事情? GAE具体是非关系型(NoSQL)数据存储区。完全没有SQL可以生成。

You should be aware that GAE, even with django-non-rel, is quite different from standard Django, and following the Django tutorial is only likely to confuse you.

您应该知道GAE,即使使用django-non-rel,也与标准Django完全不同,遵循Django教程只会让您感到困惑。

#1


1  

Why do you expect it do anything? GAE is, specifically, a non-relational (NoSQL) datastore. There is quite simply no SQL to produce.

你为什么期望它做任何事情? GAE具体是非关系型(NoSQL)数据存储区。完全没有SQL可以生成。

You should be aware that GAE, even with django-non-rel, is quite different from standard Django, and following the Django tutorial is only likely to confuse you.

您应该知道GAE,即使使用django-non-rel,也与标准Django完全不同,遵循Django教程只会让您感到困惑。