I am trying to transition my 1.8 app to Django 1.9. Simply creating the migrations for old databases is fine, but when I try to create a fresh database with migrate I get:
"Error creating new content types. Please make sure contenttypes " RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.
I have tested this a fair bit, and I can get it to build fresh if I: remove my site from URLs, migrate, add it back, and migrate again... but that's super janky, and not the clean build I am looking for. It seems that Django/core/management/base.py line 398 -> self.check() is called before the migration occurs, and the lack of a database throws an error and quits before setting up the database (catch 22). I have tested this by commenting this out, and that will also allow it to build the database.
Anyone have any recommendations for what a good way to fix this is or what the underlying problem might be in my app?
EDIT The complete stack trace:
(test) C:\website\test\rpi_csdt_community>python manage.py migrate
C:\website\test\rpi_csdt_community\collected_static/
C:\website\test\rpi_csdt_community\rpi_csdt_community\urls.py:27: RemovedInDjang
o110Warning: Support for string view arguments to url() is deprecated and will b
e removed in Django 1.10 (got rpi_csdt_community.views.home). Pass the callable
instead.
url(r'^$', 'rpi_csdt_community.views.home', {}, 'home'),
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\website\test\lib\site-packages\django\core\management\__init__.py", l
ine 353, in execute_from_command_line
utility.execute()
File "C:\website\test\lib\site-packages\django\core\management\__init__.py", l
ine 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\website\test\lib\site-packages\django\core\management\base.py", line
348, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\website\test\lib\site-packages\django\core\management\base.py", line
398, in execute
self.check()
File "C:\website\test\lib\site-packages\django\core\management\base.py", line
426, in check
include_deployment_checks=include_deployment_checks,
File "C:\website\test\lib\site-packages\django\core\checks\registry.py", line
75, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\website\test\lib\site-packages\django\core\checks\urls.py", line 13,
in check_url_config
return check_resolver(resolver)
File "C:\website\test\lib\site-packages\django\core\checks\urls.py", line 23,
in check_resolver
for pattern in resolver.url_patterns:
File "C:\website\test\lib\site-packages\django\utils\functional.py", line 33,
in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\website\test\lib\site-packages\django\core\urlresolvers.py", line 417
, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\website\test\lib\site-packages\django\utils\functional.py", line 33,
in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\website\test\lib\site-packages\django\core\urlresolvers.py", line 410
, in urlconf_module
return import_module(self.urlconf_name)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\website\test\rpi_csdt_community\rpi_csdt_community\urls.py", line 29,
in <module>
url(r'', include('project_share.urls')),
File "C:\website\test\lib\site-packages\django\conf\urls\__init__.py", line 52
, in include
urlconf_module = import_module(urlconf_module)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\website\test\rpi_csdt_community\project_share\urls.py", line 4, in <m
odule>
from project_share.views import ProjectList, ProjectTagList, ApplicationList
, DemoList
File "C:\website\test\rpi_csdt_community\project_share\views.py", line 54, in
<module>
class ProjectList(SearchableListMixin, SortableListMixin, ListView):
File "C:\website\test\rpi_csdt_community\project_share\views.py", line 59, in
ProjectList
queryset = Project.approved_projects().all()
File "C:\website\test\rpi_csdt_community\project_share\models.py", line 150, i
n approved_projects
return Project.objects.filter(approved=True)
File "C:\website\test\lib\site-packages\django\db\models\manager.py", line 122
, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\website\test\lib\site-packages\secretballot\__init__.py", line 58, in
get_queryset
content_type = ContentType.objects.get_for_model(self.model).id
File "C:\website\test\lib\site-packages\django\contrib\contenttypes\models.py"
, line 80, in get_for_model
"Error creating new content types. Please make sure contenttypes "
RuntimeError: Error creating new content types. Please make sure contenttypes is
migrated before trying to migrate apps individually.