pythondjangodjango-modelsdjango-syncdb

Django syncdb doesn't create tables from app


I am learning and it might be just stupid mistake, but syncdb and migrate creates all admin tables, but no my app tables so only Groups and Users works in admin panel. I see my models in admin panel, but when I try to enter them it gives me an error Table 'baza63843_django.testowa_news' doesn't exist.

models.py

from django.db import models

# Create your models here.

class Category(models.Model):
    name = models.CharField('Nazwa Kategorii', max_length=100)
    slug = models.SlugField('Odnośnik', unique=True, max_length=100)
    icon = models.ImageField('Ikonka Kategorii', upload_to='icons',
                              blank=True)

    class Meta:
        verbose_name = "Kategoria"
        verbose_name_plural = "Kategorie"

    def __unicode__(self):
        return self.name


class News(models.Model):
    title = models.CharField('Tytuł', max_length=255)
    slug = models.SlugField('Odnośnik', max_length=255, unique=True)
    text = models.TextField(verbose_name='Treść')
    #categories = models.ForeignKey(Category, verbose_name="Kategoria")
    #categories = models.ManyToManyField(Category, verbose_name='Kategorie')
    posted_date = models.DateTimeField('Data dodania', auto_now_add=True)

    class Meta:
        verbose_name = "Wiadomość"
        verbose_name_plural = "Wiadomości"

    def __unicode__(self):
        return self.title

At the beginning I made here ManyToManyField, but according to this I changed it. But still doesn't work.

I have my app in settings.py, it is called testowa

INSTALLED_APPS = (
    'django_admin_bootstrapped',
    #'bootstrap_admin', # always before django.contrib.admin
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    #'django.contrib.sites',
    'testowa',
)

Solution

  • You should create migrations first:

    python manage.py makemigrations
    

    After that run migrate command:

    python manage.py migrate