将 South 添加到 Django 项目、开发和生产 [英] Adding South to Django project, development & production
问题描述
将 South 添加到现有的 Django 项目中.我已经将它安装在开发机器和生产"服务器上.
Adding South to an existing Django project. I have it installed on both the development machine and the "production" server.
我在开发机上做了如下操作,然后:将South app添加到settings.py中,
I've done the following on the development machine, then: added South app to settings.py,
python manage.py syncdb
python manage.py convert_to_south myproject.myapp
然后换了一些型号,然后
then changed some models, then
python manage.py schemamigration myproject.myapp --auto
python manage.py migrate myproject.myapp
到目前为止似乎有效.我现在不太确定的是在生产服务器上做什么.只需手动重复所有这些步骤?上传修改过的settings.py,做syncdb,convert_to_south,上传修改过的models.py,做schemamigration,迁移?有些不同?教程 here 说明了将迁移添加到版本控制的一些内容,因此,他们大概应该被上传并以某种方式应用到生产服务器上?
Seems to work so far. What I am now not so sure about is what to do on the production server. Just repeat all these steps manually? Upload modified settings.py, do syncdb, convert_to_south, upload modified models.py, do schemamigration, migrate? Something different? The tutorial here says something about adding migrations to the version control, so, presumably, they should be uploaded and somehow applied on the production server?
此外,现在我在开发机器上使用 sqlite3 并在服务器上使用 mysql - 这会让事情变得不同吗?
Furthermore, right now I am using sqlite3 on the development machine and mysql on the server - does it make things any different south-wise?
推荐答案
我的向导说:
- 在服务器上安装 South.
import south
from shell 只是为了确保您使用的是相同的 python 环境. - 在
settings.py
中将'south'
添加到INSTALLED_APPS
. - 上传
settings.py
. - 重启服务器
python manage.py syncdb
.- 上传新的
app/models.py
和app/migrations/
目录. - 重启服务器.
python manage.py migrate app --fake 0001
python manage.py 迁移应用
- Install South on server.
import south
from shell just to make sure you are using the same python env. - Add
'south'
toINSTALLED_APPS
insettings.py
. - Upload
settings.py
. - Restart server
python manage.py syncdb
.- Upload new
app/models.py
andapp/migrations/
dir. - Restart server.
python manage.py migrate app --fake 0001
python manage.py migrate app
这篇关于将 South 添加到 Django 项目、开发和生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!