How to install a django nose?

I am having trouble starting a django nose.

In the installation instructions, I installed:

  • Running pip install django-nose
  • Adding 'django_nose' to INSTALLED_APPS in settings.py (including as the most recent application in case of possible problems with the application)
  • Adding TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' to settings.py

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

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

I decided that I need to synchronize the database. I use the south. When I use manage.py syncdb , django_nose does not appear in the list of synchronized applications or in the list of applications "Not synchronized (using migration)".

Finally, when I try to synchronize with the south anyway, 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 the southern version 0.7.5 installed in virtualenv.

What am I doing wrong? If nothing, how can I debug this installation problem?

+6
source share
4 answers

It seems that this is a problem with ordering applications, a quote from the django-nose manual:

Use with south

The South sets up its own testing team, which disables migration during testing. Make sure the django nose appears after the south in INSTALLED_APPS, so the django_nose test command is used.

+2
source

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

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

 INSTALLED_APPS = ( .....other apps... .... south, django_nose, ) 
+1
source

I also encountered a similar problem when using kombu.transport.django in INSTALLED_APPS. The error I received was "Incorrectly configured: the application with the django shortcut does not have the models.py module." It seems that the order of the South matters. What I did was set the south to the lowest position 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 solve the problem. The migration was successful. I used Django 1.5

0
source

Try to put the applications you want to test in PROJECT_APPS in your settings; his attempt to check django_nose and generate models for him when he doesn't have a models.py file.

0
source

Source: https://habr.com/ru/post/924275/


All Articles