On 7/04/2015 1:07 AM, Pavel Kuchin wrote:
Hi Mike,

I think the issue is that Django can't find your default DB settings.
Please take a
look: https://docs.djangoproject.com/en/1.8/ref/settings/#databases

Pavel

Thanks for responding. I have had that setting running since they were first called for in release notes for 1.6 (I think) anyway, for quite a long time. My test routine uses (settings.test) SQLite in memory as follows ...

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": ":memory:",
        "USER": "",
        "PASSWORD": "",
        "HOST": "",
        "PORT": "",
        },
    }

In production (settings.base) it is ...

dbhost = getcreds('db.host', PROJECT)
DATABASES = {
    'default': {
        'ENGINE':   'django.db.backends.postgresql_psycopg2',
        'NAME':     PROJECT,
        'USER':     dbhost[0],
        'PASSWORD': dbhost[1],
        'HOST':     dbhost[2],
        'PORT':     dbhost[3],
    }
}

Trying to run the tests in Postgres delivers the same error but with an additional final line ...

    return self.cursor.execute(sql, params)
django.core.serializers.base.DeserializationError: Problem installing fixture 'C:\Users\mike\env\xxex3\ssds\substance\fixtures\initial_data.json': relation "django_content_type" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co...
                                                             ^

In case that doesn't line up properly in the email, the caret is positioned like this ...

FROM "django_co...
     ^

The dev server runs and the software (unmigrated) works. I just cannot get my unit tests to run under 1.7. It is like the nightmare of finding yourself naked in Times Square!

Mike


Best regards, Pavel

понедельник, 6 Ð°Ð¿Ñ€ÐµÐ»Ñ  2015 г., 15:44:01 UTC+3
пользователь Mike Dewhirst Ð½Ð°Ð¿Ð¸Ñ Ð°Ð»:

    Can someone please explain what KeyError: 'default' means?

    This is the first time I have tried Django 1.7 and without doing any
    migrations all I have done here is this ...

    (xxex3) C:\Users\mike\env\xxex3\ssds>copy
    substance\fixtures\test_data.json substance\fixtures\initial_data.json

    (xxex3) C:\Users\mike\env\xxex3\ssds>python manage.py test
    --settings=ssds.settings.test --verbosity=1 common refer substance
    company workplace credit

    Python:   3.4
    Django:   1.7.7
    17:40:04
    SQLite3:  memory

    Creating test database for alias 'default'...
    Traceback (most recent call last):
        File
    
"C:\Users\mike\env\xxex3\lib\site-packages\django\contrib\contenttypes\models.py",

    line 19, in get_by_natural_key
          ct = self.__class__._cache[self.db][(app_label, model)]
    KeyError: 'default'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
        File
    "C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\utils.py",

    line 65, in execute
          return self.cursor.execute(sql, params)
        File
    
"C:\Users\mike\env\xxex3\lib\site-packages\django\db\backends\sqlite3\base.py",

    line 485, in execute
          return Database.Cursor.execute(self, query, params)
    sqlite3.OperationalError: no such table: django_content_type

    (there is more but the bottom line is ...)

          return Database.Cursor.execute(self, query, params)
    django.core.serializers.base.DeserializationError: Problem installing
    fixture 'C:\Users\
    mike\env\xxex3\ssds\substance\fixtures\initial_data.json': no such
    table: django_content_type

    (xxex3) C:\Users\mike\env\xxex3\ssds>

      From my settings ...

    SESSION_SERIALIZER =
    'django.contrib.sessions.serializers.JSONSerializer'

    #CACHES = {
    #    'default': {
    #        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
    #    }
    #}

    The same error occurs whether CACHES is commented out or not.

    Not sure where to look in the documentation.
    https://docs.djangoproject.com/en/1.7/topics/http/sessions/
    <https://docs.djangoproject.com/en/1.7/topics/http/sessions/> got me
    thinking (out of my depth) about sessions and serialization.

    It seems Django 1.7 (or maybe 1.8) removes the 'name' column from
    content_types upon migration and the migrated tables crash Django 1.6
    (naturally I suppose). That means I'm stuck on 1.6 until I can get
    things going on 1.7 and/or 1.8.

    Is it possible to run with 1.7 without migrating the Django apps?

    Any help will be much appreciated

    Thanks

    Mike


--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/240490f9-eaa3-4b54-ba93-237218357a87%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/240490f9-eaa3-4b54-ba93-237218357a87%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55233B9F.3040903%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to