How to get django-nose installed correctly?
Asked Answered
N

4

6

I'm having trouble getting django-nose running.

Per the installation instructions, I installed by:

  1. Running pip install django-nose
  2. Adding 'django_nose' to INSTALLED_APPS in settings.py (including at as the very last app, in case of possible app order issues)
  3. Adding TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' to settings.py

When I run a test i.e. manage.py test, I get:

django.db.utils.DatabaseError: no such table: django_content_type

I figured I need to sync the database. I am using South. When I use manage.py syncdb, django_nose doesn't show up in either the list of synced apps nor the list of "Not synced (use migrations)" apps.

Finally, when I try syncing with south anyhow, i.e. manage.py schemamigration django_nose --initial, I get:

django.core.exceptions.ImproperlyConfigured: App with label django_nose is missing a models.py module.

I have Django 1.4 with South version 0.7.5 installed in a virtualenv.

What am I doing wrong? If nothing, how do I go about debugging this install problem?

Neri answered 31/8, 2012 at 12:35 Comment(1)
I had the same problem. After running nosetests command from the project root,django_nose now works. It still does not show in the app list when running ./manage.py syncdb, however. I have no idea why this works!Sidon
A
2

Looks like it's an issue about apps ordering, a quote from django-nose manual:

Using With South

South installs its own test command that turns off migrations during testing. Make sure that django-nose comes after south in INSTALLED_APPS so that django_nose's test command is used.

Alister answered 31/8, 2012 at 12:55 Comment(1)
Afraid not. I suspected app order so I actually tried putting django_nose very last in INSTALLED_APPS, to no avail.Neri
T
1

If you read the docs on github carefully, the problem is that when south is installed you need to put django_nose below south, read more.

So your INSTALLED_APPS in settings.py file should look something like below:

INSTALLED_APPS = (
.....other apps...
....

south,
django_nose,
) 
Triangle answered 19/9, 2012 at 0:50 Comment(1)
Hey thanks, but I did try this already, including with django_nose very last in INSTALLED_APPS.Neri
R
0

I too encountered similar issue while using kombu.transport.django in the INSTALLED_APPS. The error I got was "ImproperlyConfigured: App with label django is missing a models.py module.". Looks like the ordering of South does matter. What I did was to put south in the very bottom of the INSTALLED_APPS,

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'djcelery',
'kombu.transport.django',
'sdm',
'cycletel_admin',
'django.contrib.admin',
'lettuce.django',
'south'
) 

This helped resolve the issue. The migrations ran successfully. I used Django 1.5

Rapine answered 18/3, 2013 at 17:9 Comment(0)
N
0

Try putting the apps you want to test into PROJECT_APPS in your settings; its trying to test django_nose and generate models for it when it doesn't have a models.py file.

Nesselrode answered 23/12, 2013 at 1:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.