问题
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