salvaorenick / django-cms-redirects

A django app that lets you store simple redirects in a database and handles the redirecting for you. Integrated with Django CMS to allow you to link directly to a page object. Based off django.contrib.redirects
BSD 3-Clause "New" or "Revised" License
26 stars 23 forks source link

Redirect add fails #6

Open klebed opened 12 years ago

klebed commented 12 years ago

Hi! I have a little problem with cms-redirect.

Installed cms-redirects from pip, added in INSTALLED_APPS, done manage.py migrate, but now getting strange error, while trying to add new redirect:

(1452, 'Cannot add or update a child row: a foreign key constraint fails (appname.cms_redirects_cmsredirect, CONSTRAINT site_id_refs_id_59d206086c6310a1 FOREIGN KEY (site_id) REFERENCES django_site (id))')

andrewschoen commented 12 years ago

Do you have django.contrib.sites in INSTALLED_APPS?

klebed commented 12 years ago

INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles',

Uncomment the next line to enable the admin:

'django.contrib.admin',
'cms', #django CMS itself
'mptt', #utilities for implementing a modified pre-order traversal tree
'menus', #helper for model independent hierarchical website navigation
'south', #intelligent schema and data migrations
'sekizai', #for javascript and css management
'cms.plugins.file',
'cms.plugins.flash',
'cms.plugins.googlemap',
'cms.plugins.link',
'cms.plugins.picture',
'cms.plugins.snippet',
'cms.plugins.teaser',
'cms.plugins.text',
'cms.plugins.video',
'cms.plugins.twitter',
'tinymce',
'filebrowser',
'uploadify',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'cms_redirects',

)

andrewschoen commented 12 years ago

Maybe try a python manage.py syncdb before the migrate. Seems like for whatever reason the site table isn't being created.

If that doesn't work you might just try to include the project directly from the master branch here on github. We haven't pushed up to pypi in a bit.

klebed commented 12 years ago

Ok. I will try both ways.

benjaoming commented 11 years ago

Had the same error message with a different application.

It turned out, I had created django_sites at an earlier point in time, and it was MyISAM but needed to be InnoDB. Changing it fixed the error.