1
既存のDjango 1.10アプリケーションがあり、新しいデータベースをゼロからローカルに作成したいと思います。私は例外ここ既存のDjangoプロジェクトでdbを最初から復元することはできません
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 23, in ready
self.module.autodiscover()
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/me/workspace/myproject-django/customauth/admin.py", line 7, in <module>
from core.admin import ShopInline
File "/home/me/workspace/myproject-django/core/admin.py", line 242, in <module>
admin.site.register(Campaign, CampaignAdmin)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 108, in register
admin_obj = admin_class(model, self)
File "/home/me/workspace/myproject-django/core/admin.py", line 104, in __init__
last_task = TaskState.objects.filter(name='core.tasks.compute_metrics', state='SUCCESS').order_by('tstamp').last()
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 565, in last
objects = list((self.reverse() if self.ordered else self.order_by('-pk'))[:1])
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 256, in __iter__
self._fetch_all()
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 1087, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 54, in __iter__
results = compiler.execute_sql()
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 835, in execute_sql
cursor.execute(sql, params)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/me/workspace/myproject-django/venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "celery_monitor_taskstate" does not exist
LINE 1: ...ker_id", "celery_monitor_taskstate"."hidden" FROM "celery_mo...
を取得しています
$ createdb -h localhost -p 5432 -U me -w my_db # OK
$ ./manage.py migrate
これらのステップに続いて
は私requirements.txt
celery==4.0.2
django-celery-beat==1.0.1
django-celery-monitor==1.1.0
django-celery-results==1.0.1
の関連する部分であり、ここでINSTALLED_APPS
INSTALLED_APPS = (
'modeltranslation',
...
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.postgres',
'django_countries',
'django_extensions',
'django.contrib.humanize',
'django_celery_results',
'django_celery_beat',
'django_celery_monitor',
...
)
は私が
$ ./manage.py migrate django_celery_monitor # also tried for _results and _beat
を実行しようとしましたが、それは同じエラーをスローします。
完全なトレースバックを表示します。なぜあなたは本当にマイグレーションしたいときに '--fake'を使っていますか? –
あなたは '--fake'について正しいですが、意味をなさない。とにかく、フラグの有無にかかわらず同じ問題が発生します。 – Buddyshot
ああ私は今それを得る...問題を見つけるためにトレースバック全体を読んでいた。 – Buddyshot