简体   繁体   中英

Django runserver ImportError

I'm running Django 1.9 on python 3.4 in a virtualenv. It has been working, but today, it's not.

When I run ./manage.py runserver, I get the following error:

 (django1)dan@danvb:~/Share/django1/suorganizer$ ./manage.py runserver Performing system checks... System check identified no issues (0 silenced). Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f48a01d2c80> Traceback (most recent call last): File "/home/dan/Share/django1/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "/home/dan/Share/django1/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check_migrations() File "/home/dan/Share/django1/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 163, in check_migrations executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) File "/home/dan/Share/django1/lib/python3.4/site-packages/django/db/migrations/executor.py", line 20, in __init__ self.loader = MigrationLoader(self.connection) File "/home/dan/Share/django1/lib/python3.4/site-packages/django/db/migrations/loader.py", line 49, in __init__ self.build_graph() File "/home/dan/Share/django1/lib/python3.4/site-packages/django/db/migrations/loader.py", line 170, in build_graph self.load_disk() File "/home/dan/Share/django1/lib/python3.4/site-packages/django/db/migrations/loader.py", line 105, in load_disk migration_module = import_module("%s.%s" % (module_name, migration_name)) File "/home/dan/Share/django1/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked ImportError: No module named 'core.migrations.delete' 

I uninstalled and reinstalled Django==1.9, and get the same error. In lib/python3.4/site-packages/django/core/, I don't have a migrations directory. I'm not sure what to look for. The command ./manage.py runserver worked for me on this project not so long ago.

Thank you.

Solved.

In I have a Django migrations folder, core/migrations/ in which instead of actually deleting a migration module, I renamed it xxx.delete thinking I might want to revert to it. Upon actually deleting that module, my ImportError was resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM