django CMS error cms_urlconfrevision on deployment

若如初见. 提交于 2021-01-28 05:02:51

问题


I'm trying to deploy a django CMS app to PythonAnywhere or Heroku but I keep getting this error on Heroku:

ProgrammingError at /
relation "cms_urlconfrevision" does not exist
LINE 1: ...sion"."id", "cms_urlconfrevision"."revision" FROM "cms_urlco...

and this error on PythonAnywhere:

OperationalError at /
no such table: cms_urlconfrevision

The app works fine on localhost.

I understand it's a database table missing but I have no idea how to fix it. I tried removing all the migration files and .pyc files and migrated again, I removed the database, I tried migration with --fake. Nothing seems to work.

I'm using

  • django-cms==3.6.0
  • Django==2.1.8

回答1:


I understand it's a database table missing but I have no idea how to fix it. I tried removing all the migration files and .pyc files and migrated again, I removed the database, I tried migration with --fake. Nothing seems to work.

Migration files just define what migrations exist. They don't modify your database by themselves. There are two steps here:

  1. Creating migrations with makemigrations. This should only be done on your development machine. By the time your code is being deployed you shouldn't have any model changes that would cause new migrations to be generated.

  2. Applying migrations to your database with migrate. This must be done in development (to update your local database) and also in production (to update your production database).

    On Heroku, you'd run your migrations with

    heroku run python manage.py migrate
    

    I think this is the step you're missing.




回答2:


Hello maybe you found the solution but if the is somebody coming across that issue, it due to the database settings.

In project_name/site_name/settings.py and database settings section

Change

NAME: 'project.db' 

to

NAME:'project_name/project.bd'


来源:https://stackoverflow.com/questions/56283143/django-cms-error-cms-urlconfrevision-on-deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!