title: Django: OperationalError No Such Table
body: <p>I'm building a fairly simple application, research, in my Django project that uses Django-CMS.  (It's my first ground-up attempt at a project/application.)  Its main purpose is to store various intellectual assets (i.e article, book, etc. written by a researcher).</p>
  <p>The problem is that when I point the browser to <code>/research/</code> I get an error saying that the <code>table 'research_journal' doesn't exist (&quot;no such table&quot;)</code>.</p>
  <p>I'm using Djnago 1.6.5 with a sqlite3 database.</p>
  <p>Looking at <code>python manage.py sql research</code> yields:</p>
  <pre><code>BEGIN;
  CREATE TABLE &quot;research_researchbase&quot; (
      &quot;id&quot; integer NOT NULL PRIMARY KEY,
      &quot;pub_date&quot; datetime NOT NULL,
      &quot;authors&quot; varchar(200) NOT NULL,
      &quot;year&quot; varchar(25) NOT NULL,
      &quot;title&quot; varchar(200) NOT NULL,
      &quot;subtitle&quot; varchar(200) NOT NULL,
      &quot;image_id&quot; integer NOT NULL REFERENCES &quot;filer_image&quot; (&quot;file_ptr_id&quot;),
      &quot;link&quot; varchar(200) NOT NULL
  )
  ;
  CREATE TABLE &quot;research_journal&quot; (
      &quot;researchbase_ptr_id&quot; integer NOT NULL PRIMARY KEY REFERENCES &quot;research_researchbase&quot; (&quot;id&quot;),
      &quot;journal&quot; varchar(200) NOT NULL,
      &quot;abstract&quot; text NOT NULL,
      &quot;citation&quot; varchar(200) NOT NULL
  )
  ;
  CREATE TABLE &quot;research_encyclopedia_chapter&quot; (
      &quot;researchbase_ptr_id&quot; integer NOT NULL PRIMARY KEY REFERENCES &quot;research_researchbase&quot; (&quot;id&quot;),
      &quot;encyclopedia&quot; varchar(200) NOT NULL,
      &quot;publisher&quot; varchar(200) NOT NULL,
      &quot;summary&quot; varchar(200) NOT NULL
  )
  ;
  CREATE TABLE &quot;research_book&quot; (
      &quot;researchbase_ptr_id&quot; integer NOT NULL PRIMARY KEY REFERENCES &quot;research_researchbase&quot; (&quot;id&quot;),
      &quot;publisher&quot; varchar(200) NOT NULL,
      &quot;summary&quot; varchar(200) NOT NULL
  )
  ;
  
  COMMIT;
  </code></pre>
  <p>I've run <code>python manage.py migrate research</code> and get:</p>
  <pre><code>/Users/XXX/Documents/repos/sfs/env/lib/python2.7/site-packages/app_data/fields.py:2: DeprecationWarning: django.utils.simplejson is deprecated; use json instead.
    from django.utils import simplejson as json
  
  Running migrations for research:
  - Nothing to migrate.
   - Loading initial data for research.
  Installed 0 object(s) from 0 fixture(s)
  </code></pre>
  <p>I've run <code>python manage.py syncdb</code> and get the following:</p>
  <pre><code>Syncing...
  Creating tables ...
  Installing custom SQL ...
  Installing indexes ...
  Installed 0 object(s) from 0 fixture(s)
  
  Synced:
   &gt; djangocms_admin_style
   &gt; django.contrib.auth
   &gt; django.contrib.contenttypes
   &gt; django.contrib.sessions
   &gt; django.contrib.admin
   &gt; django.contrib.sites
   &gt; django.contrib.sitemaps
   &gt; django.contrib.staticfiles
   &gt; django.contrib.messages
   &gt; mptt
   &gt; south
   &gt; sekizai
   &gt; django_select2
   &gt; hvad
  
  Not synced (use migrations):
   - djangocms_text_ckeditor
   - cms
   - menus
   - djangocms_style
   - djangocms_column
   - djangocms_file
   - djangocms_flash
   - djangocms_googlemap
   - djangocms_inherit
   - djangocms_link
   - djangocms_picture
   - djangocms_teaser
   - djangocms_video
   - reversion
   - polls
   - djangocms_polls
   - aldryn_blog
   - easy_thumbnails
   - filer
   - taggit
   - research
  (use ./manage.py migrate to migrate these)
  </code></pre>
  <p>Here's the <code>models.py</code>:</p>
  <pre><code>from django.db import models
  from django.utils import timezone
  from filer.fields.image import FilerImageField
  
  import datetime
  
  class ResearchBase(models.Model):
      pub_date = models.DateTimeField('date published')
      authors = models.CharField(max_length=200)
      year = models.CharField(max_length=25)
      title = models.CharField(max_length=200)
      subtitle = models.CharField(max_length=200, blank=True)
      image = FilerImageField()
      link = models.CharField(max_length=200, blank=True)
      
      def __unicode__(self):
          return self.title
      
      def was_published_recently(self):
          return self.pub_date &gt;= timezone.now() - datetime.timedelta(days=1)
          
  
  class Journal(ResearchBase):
      journal = models.CharField(max_length=200)
      abstract = models.TextField()
      citation = models.CharField(max_length=200)
      
      
  class Encyclopedia_Chapter(ResearchBase):
      encyclopedia = models.CharField(max_length=200)
      publisher = models.CharField(max_length=200)
      summary = models.CharField(max_length=200)
      
          
  class Book(ResearchBase):
      publisher = models.CharField(max_length=200)
      summary = models.CharField(max_length=200)
  </code></pre>
  <p>Here's my <code>views.py</code> (note that I am passing two objects through render, ignore the fact that I have yet to include the class Books in the whole deal):</p>
  <pre><code>from django.shortcuts import render, get_object_or_404
  from django.http import HttpResponse, Http404
  from django.template import RequestContext, loader
  
  from research.models import Journal, Encyclopedia_Chapter, Book
  
  def research_index(request):
      latest_journal_list = Journal.objects.order_by('-pub_date')[:5]
      latest_chapter_list = Encyclopedia_Chapter.objects.order_by('-pub_date')[:5]
      
      context = {
          'latest_journal_list': latest_journal_list,
          'latest_chapter_list': latest_chapter_list
      }
      
      return render(request, 'research/index.html', context)
      
  def journal_detail(request, journal_id):
      journal = get_object_or_404(Journal, pk=journal_id)
      return render(request, 'research/journal_detail.html', {'journal': journal})
      
  def chapter_detail(request, chapter_id):
      chapter = get_object_or_404(Encyclopedia_Chapter, pk=chapter_id)
      return render(request, 'research/chapter_detail.html', {'chapter': chapter})
  </code></pre>
  <p>Here's the application's <code>url.py</code>:</p>
  <pre><code>from django.conf.urls import patterns, url
  
  from research import views
  
  urlpatterns = patterns('',
      url(r'^$', views.research_index, name='research'),
      url(r'^(?P&lt;journal_id&gt;\d+)/$', views.journal_detail, name='journal_detail'),
      url(r'^(?P&lt;chapter_id&gt;\d+)/$', views.chapter_detail, name='chapter_detail'),
  )
  </code></pre>
  <p>Here's the <code>index.html</code> template:</p>
  <pre><code>{% extends 'research/base.html' %}
  
  {% block research_content %}
  
  &lt;div class=&quot;container&quot;&gt;
      &lt;div class=&quot;row featurette&quot;&gt;
          &lt;h3 id=&quot;research&quot;&gt;Peer-reviewed Journal Articles&lt;/h3&gt;
          {% if latest_journal_list %}
              &lt;ul id=&quot;research&quot;&gt;
              {% for journal in latest_journal_list %}
                  &lt;li id=&quot;research&quot;&gt;
                              &lt;img src=&quot;{{ journal.image.url }}&quot; id=&quot;research&quot;&gt;
                              &lt;h4&gt;{{ journal.journal }}&lt;/h4&gt;
                              &lt;h5&gt;{{ journal.title }}&lt;/h5&gt;
                              &lt;a href=&quot;{% url 'research:journal_detail' journal.id %}&quot;&gt;Read More&lt;/a&gt;
                          &lt;/li&gt;
              {% endfor %}
              &lt;/ul&gt;
          {% else %}
              &lt;p&gt;No journals are available.&lt;/p&gt;
          {% endif %}
      &lt;/div&gt;
      
      &lt;div class=&quot;row featurette&quot;&gt;
          &lt;h3 id=&quot;research&quot;&gt;Encyclopedia Chapters&lt;/h3&gt;
          {% if latest_chapter_list %}
              &lt;ul id=&quot;research&quot;&gt;
              {% for chapter in latest_chapter_list %}
                  &lt;li id=&quot;research&quot;&gt;
                              &lt;img src=&quot;{{ chapter.image.url }}&quot; id=&quot;research&quot;&gt;
                              &lt;h4&gt;{{ chapter.journal }}&lt;/h4&gt;
                              &lt;h5&gt;{{ chapter.title }}&lt;/h5&gt;
                              &lt;a href=&quot;{% url 'research:chapter_detail' chapter.id %}&quot;&gt;Read More&lt;/a&gt;
                          &lt;/li&gt;
              {% endfor %}
              &lt;/ul&gt;
          {% else %}
              &lt;p&gt;No encyclopedia chapters are available.&lt;/p&gt;
          {% endif %}
      &lt;/div&gt;
  &lt;/div&gt;
  
  {% endblock %}
  </code></pre>
  <p>Just in case it matters, here's my <code>cms_app.py</code>:</p>
  <pre><code>from cms.app_base import CMSApp
  from cms.apphook_pool import apphook_pool
  from django.utils.translation import ugettext_lazy as _
  
  
  class ResearchApp(CMSApp):
      name = _(&quot;Research App&quot;)
      urls = [&quot;research.urls&quot;]
      app_name = &quot;research&quot;
  
  apphook_pool.register(ResearchApp)
  </code></pre>