2017-09-01 2 views
1

Ich versuche, Django von 1.10.7 auf 1.11.4 mit Python 2.7.11 zu aktualisieren. Ich habe pip install Django -U ausgeführt und python -c "import django; print django.get_version()" bestätigt, dass Django 1.11.4 installiert ist. Wenn ich dann aber Tests mache, bekomme ich ImportError: No module named notmigrations. Hat jemand einen Rat?Upgrade auf Django 1.11.4 ImportError

Hier ist der vollständige Stack-Trace:

Traceback (most recent call last): 
    File "./manage.py", line 25, in <module> 
    execute_from_command_line(sys.argv) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line 
    utility.execute() 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/commands/test.py", line 29, in run_from_argv 
    super(Command, self).run_from_argv(argv) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute 
    output = self.handle(*args, **options) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/commands/test.py", line 62, in handle 
    failures = test_runner.run_tests(test_labels) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/test/runner.py", line 601, in run_tests 
    old_config = self.setup_databases() 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/test/runner.py", line 546, in setup_databases 
    self.parallel, **kwargs 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/test/utils.py", line 187, in setup_databases 
    serialize=connection.settings_dict.get('TEST', {}).get('SERIALIZE', True), 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 69, in create_test_db 
    run_syncdb=True, 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/__init__.py", line 130, in call_command 
    return command.execute(*args, **defaults) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute 
    output = self.handle(*args, **options) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 83, in handle 
    executor = MigrationExecutor(connection, self.migration_progress_callback) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__ 
    self.loader = MigrationLoader(self.connection) 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__ 
    self.build_graph() 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/loader.py", line 203, in build_graph 
    self.load_disk() 
    File "/home/vagrant/.virtualenvs/rhw/lib/python2.7/site-packages/django/db/migrations/loader.py", line 82, in load_disk 
    module = import_module(module_name) 
    File "/usr/local/lib/python2.7.11/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
ImportError: No module named notmigrations 
+0

haben Sie verwendet Befehl migrieren? – Mattia

Antwort

3

Es sieht aus wie Sie notmigrations in Ihrer MIGRATION_MODULES Einstellung verwenden Migrationen zu deaktivieren (wie in this post beschrieben). In Django 1.9+ sollten Sie einfach None anstelle eines gefälschten Modulnamens wie 'notmigrations' (release notes) verwenden.

+0

Danke, aber das ist nur ein Teil davon. Ich fand die Zeile 'MIGRATION_MODULES = DisableMigrations()' in meinen Einstellungen und änderte es in 'MIGRATION_MODULES = None', und jetzt gibt es mir' TypeError: Argument vom Typ 'NoneType' ist nicht iterierbar. – panatale1

+0

Ich habe nicht gesagt, um zu setzen 'MIGRATION_MODULES = None', ich habe gesagt, '' notmigrations' durch 'None' zu ​​ersetzen. Bearbeiten Sie Ihre Klasse "DisableMigrations", um "None" anstelle von "notmigrations" zurückzugeben. – Alasdair

+0

Nachdem ich in den Urlaub gefahren bin und dann aufholen musste, habe ich es endlich geschafft und es hat funktioniert. Vielen Dank!! – panatale1

1

für Django 2.0 I create Einstellungsdatei wie beschrieben here mit Inhalt wie:

from settings import * 

class DisableMigrations(object): 
    def __contains__(self, item): 
     return True 

    def __getitem__(self, item): 
     return None 

MIGRATION_MODULES = DisableMigrations() 

und meine Tests mit Testlauf neu

erstellt Einstellung
Verwandte Themen