私はモデル言語を作成しました。私はmakemigrations
とmigrate
の部分をしました。すべてうまくいった。私はdbを設定ファイルに登録しました。私は問題を見ないDjango Admin no such table
from django.db import models
class Oxn(models.Model):
objectId = models.CharField(max_length=100, unique=True)
name = models.CharField(max_length=100)
picture = models.CharField(max_length=200)
class Language(models.Model):
objectId = models.CharField(max_length=100, unique=True)
code = models.CharField(max_length=10)
language = models.CharField(max_length=100)
:私のモデルは、次のように定義されて
OperationalError at /admin/testdb/language/
no such table: testdb_language
Request Method: GET
Request URL: http://localhost:8000/admin/testdb/language/
Django Version: 1.9.5
Exception Type: OperationalError
Exception Value:
no such table: testdb_language
Exception Location: /Users/nep/Documents/Development/Private/testdjango/myvenv/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py in execute, line 323
Python Executable: /Users/nep/Documents/Development/Private/testdjango/myvenv/bin/python
Python Version: 3.5.1
Python Path:
['/Users/nep/Documents/Development/Private/testdjango',
'/Library/Frameworks/Python.framework/Versions/3.5/lib/python35.zip',
'/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5',
'/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload',
'/Users/nep/Documents/Development/Private/testdjango/myvenv/lib/python3.5/site-packages']
:私はこれを取得、管理ページに言語テーブルをクリックし
。誰か助けてくれますか?
EDIT:移行から
0001_initial.pyコンテンツ下記た
(myvenv) ➜ gins4udjango python manage.py showmigrations
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
ginsdb
[X] 0001_initial
sessions
[X] 0001_initial
EDIT:これは移行の出力は
ある
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-29 14:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Country',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('objectId', models.CharField(max_length=100, unique=True)),
('name', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Gin',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('objectId', models.CharField(max_length=100, unique=True)),
('alcohol', models.FloatField(blank=True, default=None, null=True)),
('name', models.CharField(max_length=100)),
('picture', models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name='GinLocal',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('objectId', models.CharField(max_length=100, unique=True)),
('origin', models.TextField()),
('serve', models.TextField()),
('aroma', models.TextField()),
('country', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ginsdb.Country', to_field='objectId')),
('gin', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ginsdb.Gin', to_field='objectId')),
],
),
migrations.CreateModel(
name='Language',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('objectId', models.CharField(max_length=100, unique=True)),
('code', models.CharField(max_length=10)),
('language', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Type',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('objectId', models.CharField(max_length=100, unique=True)),
('typeName', models.CharField(max_length=100)),
('language', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ginsdb.Language', to_field='objectId')),
],
),
migrations.AddField(
model_name='ginlocal',
name='language',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ginsdb.Language', to_field='objectId'),
),
migrations.AddField(
model_name='ginlocal',
name='types',
field=models.ManyToManyField(to='ginsdb.Type'),
),
migrations.AddField(
model_name='country',
name='language',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ginsdb.Language', to_field='objectId'),
),
]
'./manage.py showmigrations'と表示すると、次のコマンドを実行して、モデルを作成するために必要なSQLを表示できます: 'testdb'アプリケーションの移行内容は何ですか? – Alasdair
トピックに追加しました – user1007522
'Language'と' Oxn'のアプリはどちらですか?それは本当に 'testdb'と呼ばれていますか? – Alasdair