你想sqlreset
工作:
% python manage.py help sqlreset
Usage: manage.py sqlreset [options] <appname appname ...>
Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).
Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=all output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--version show program's version number and exit
-h, --help show this help message and exit
就像當你修改模型,Django將不會自動爲你做這個。它只會輸出用於複製和粘貼的命令。
您可能只需安裝Django命令擴展即可獲得reset_db和其他好吃的東西:http://code.google.com/p/django-command-extensions/ – 2010-02-18 20:15:20
這看起來很有希望! – jathanism 2010-02-18 20:17:37
太棒了 - 這看起來正是我需要的! – 2010-02-18 23:24:35