私はdjango-cities
という名前のアプリをアンインストールしようとしていますが、私のアプリで「場所」私はVenue
と呼ばれるモデルで、その移行0001_initial.py
にForeingKey
からcities.Subregion
モデルを持っていたを持っていますdjango-cities
です。をアンインストールし、アプリAアプリBは、1歳の移行における依存性を持っていることを
私はINSTALLED_APPS
のdjango-cities
を削除するために進めたが、私は次のエラーました:その後、私はそれらの依存関係を削除し、django-cities
をアンインストールし、すべてが私のために働いたが、誰がプロジェクトをインストールする必要がある場合、
Traceback (most recent call last):
File "/home/d/.virtualenvs/beplay/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/home/d/.virtualenvs/beplay/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 128, in inner_run
self.check_migrations()
File "/home/d/.virtualenvs/beplay/local/lib/python2.7/site-packages/django/core/management/base.py", line 422, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/home/d/.virtualenvs/beplay/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
self.loader = MigrationLoader(self.connection)
File "/home/d/.virtualenvs/beplay/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 52, in __init__
self.build_graph()
File "/home/d/.virtualenvs/beplay/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 274, in build_graph
raise exc
django.db.migrations.exceptions.NodeNotFoundError: Migration places.0001_initial dependencies reference nonexistent parent node (u'cities', u'0010_adjust_unique_attributes')
を私はrequirements.txt
から削除し、それがまだ移行に参照されているため、
ValueError: Related model u'cities.Subregion' cannot be resolved
:migrate
コマンドは次のエラーが発生します0:
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Venue',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
('name', models.CharField(max_length=255)),
('phone', models.CharField(blank=True, max_length=255, null=True)),
('mobile', models.CharField(blank=True, max_length=255, null=True)),
('email', models.EmailField(blank=True, max_length=254, null=True)),
('address', models.CharField(blank=True, max_length=255, null=True)),
('latitude', models.CharField(blank=True, max_length=100, null=True)),
('longitude', models.CharField(blank=True, max_length=100, null=True)),
('subregion', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cities.Subregion')),
],
options={
'abstract': False,
},
),
]
その後、私は行を削除:
('subregion', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cities.Subregion')),
をし、別のエラーを持っている:
AttributeError: 'NoneType' object has no attribute 'is_relation'
また、私はこれをGoogleでも、プロジェクトからすべての.pyc
のファイルを削除しようとしましたエラーがあり、thisが見つかりましたが、回答はありませんでした。
これに関する情報はありますか?
私の悪い英語をありがとうと申し訳ありません。
注:あなたが進む前に、データベースから古いVenue
テーブルを削除する必要があり、次のソリューションの両方について
試してみます。 –
DBからVenueテーブルを削除したくありません。 –