django makemigrations不起作用

时间:2017-02-15 14:14:37

标签: python django

我想为game.characters

进行迁移
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'rest_framework',
    'django_summernote',

    'lucifer',
    'users',
    'posts',

    'game',
    'game.characters',
]

我使用命令

python lucifer/manage.py makemigrations users posts game game.characters
python lucifer/manage.py migrate

App 'game.characters' could not be found. Is it in INSTALLED_APPS?

我不明白为什么?

这是我的game.characters

from django.db import models
from django.conf import settings
from game.quests.models import Quest


class Character(models.Model):

    user = models.ForeignKey(
        settings.AUTH_USER_MODEL,
        )

    nickname = models.CharField(
        max_length=8,
        )

    level = models.IntegerField(
        default=1,
        )

    JOB_CHOICE = (
        ('killer', '나이트'),
        ('gunshoter', '야만전사'),
        ('monster', '팔라딘'),
        )

    job = models.CharField(
        max_length=4,
        choices=JOB_CHOICE,
        null=True,
        blank=True,
        )

├── Makefile
├── README.md
├── lucifer
│   ├── db.sqlite3
│   ├── game
│   │   ├── __init__.py
│   │   └── characters
│   │       ├── __init__.py
│   │       └── models
│   │           ├── __init__.py
│   │           └── character.py
│   ├── lucifer
│   │   ├── __init__.py
│   │   ├── settings
│   │   │   ├── __init__.py
│   │   │   ├── development.py
│   │   │   ├── partials
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   ├── database.py
│   │   │   │   ├── static.py
│   │   │   │   └── summernote.py
│   │   │   └── production.py
│   │   ├── templates
│   │   ├── urls.py
│   │   ├── views
│   │   │   ├── __init__.py
│   │   │   ├── __pycache__
│   │   │   └── home.py
│   │   └── wsgi.py
│   ├── manage.py

1 个答案:

答案 0 :(得分:2)

makemigrations命令采用app labelcharacters,而非game.characters

python lucifer/manage.py makemigrations characters