I'm very new to django and in turn the django-cms app.
I have followed the tutorial step by step: (from the offical website ) on a new machine and have everything exactly as the tutorial does yet I still can't get anywhere.
I get to the final step in the setup process and everything falls over, When I run:
python manage.py syncdb --all
I get the following error:
CommandError: One or more models did not validate:
cms.page: 'site' has a relation with model <class 'django.contrib.sites.models.Site'>, which has either not been installed or is abstract.
cms.globalpagepermission: 'sites' has an m2m relation with model <class 'django.contrib.sites.models.Site'>, which has either not been installed or is abstract.
To clarify this is happening at step 1.3.2.1. Fresh install in the tutorial
Run:
python manage.py syncdb --all
python manage.py migrate --fake
None of these commands work, both result in the above error.
I am not sure how to solve this or even find resource as to what is causing my problem, I have spent a short amount of time on both google and stackoverflow looking for answers with no result, I haven't been able to pin point the problem which is probably making things harder for me.
Any help is much appreciated.
My code is exactly the same as the tutorials which is why I haven't posted any.
you can either: temporarily remove your migration, execute python manage.py migrate, add again your migration and re-execute python manage.py migrate. Use this case if the migrations refer to different models and you want different migration files for each one of them.
migrate , which is responsible for applying and unapplying migrations. makemigrations , which is responsible for creating new migrations based on the changes you have made to your models.
No, you don't need to use migrations. (Also, it may be relevant to note that you can use raw SQL, but Django will still set up some things for you so you can use its ORM, even with legacy databases. But migrations are not one of these things it does for you.)
Migrations are stored within the <app_name>/migrations directory.
I'm guessing that you are using the new Django 1.6. There the sites
application is no longer included by default in your project. And as it seems the django-cms
depends on it.
You can add it easily to the list of enabled applications in your settings.py
file, in the INSTALLED_APPS
list:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites', # <----- here!
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With