How to start a django cms project
I decided to take a look to django-cms. After looking at the docs I cloned the repository using
git clone https://github.com/divio/django-cms.git
Then I installed it using
sudo python setup.py install
I already have django 1.2.3 installed. I moved to the example
directory an ran syncdb
which created the following tables:
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_admin_log
Creating table django_site
Creating table sampleapp_category
Creating table sampleapp_picture
Creating table south_migrationhistory
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes...
We can clearly see that the cms tables are not created. I'm obviously facing that problem when running the server and browsing http://localhost:8000/
DatabaseError: no such table: cms_page
I've looked at the docs and seen that I meet the requirements regarding the versions bu开发者_如何学Got clearly, I'm doing something wrong. Any help would be greatly appreciated.
django-cms uses South for database migrations. Models handled by South are not synced to the database using syncdb
. You have to use manage.py migrate
.
Since you don't have any tables and data from django-cms to migrate, a faster solution would be this process:
- comment out
'south'
in yourINSTALLED_APPS
- run
manage.py syncdb
(this will create all the tables from django-cms) - re-enable south in your
INSTALLED_APPS
- run
manage.py migrate --fake
The next time you update django-cms, you can then run manage.py migrate
to update your database tables.
Did you put 'cms'
in INSTALLED_APPS
in settings.py
? Django-CMS furthermore requires also menus
, publisher
and mptt
installed as well as some middleware. This is some nice to read documentation on it!
In general, if tables are not created there can be some errors in the application itself: try running Django shell and import a model from the application:
python manage.py shell
>>> from csm import models
and check if you get a traceback.
Hope this can help.
精彩评论