Why is django manage.py syncdb failing to create new columns on my development server?

China☆狼群 提交于 2019-12-24 00:52:12

问题


I am trying to create a development server from a production server from which I can test out new ideas.

I created a duplicate of my production server's database by dumping it using Postgres' db_dump and then imported the dump into a new database.

I then copied my production django directory and altered all .py files to refer to server_debug. rather than server in my import statements.

Using the admin interface to alter some data works in that only the development server has its data altered.

However, when I then try adding a new field in my models.py in my development server, manage.py syncdb fails to create it.

Is there something I am neglecting that could cause manage.py to refer to my production server rather than my development server?


回答1:


syncdb doesn't touch tables that already exist. You need to either reset the app (easiest if you don't care about the data), modify the table manually (more of a quick hack) or use a migration app and version your models — South, for example.



来源:https://stackoverflow.com/questions/11193835/why-is-django-manage-py-syncdb-failing-to-create-new-columns-on-my-development-s

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