向南加入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.
我在开发机器上完成了以下工作,然后:将南方应用程序添加到设置。 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,做模式迁移,迁移?有些不同?本教程此处介绍了如何将迁移添加到版本控制中,所以可能应该是上传并以某种方式应用在生产服务器上?
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。 c code code code code code code $ c < 到
INSTALLED_APPS
在settings.py
。 - 上传
settings.py
。 - 重新启动服务器
-
python manage.py syncdb
。 - 上传新的
app / models.py
和应用/迁移/
dir。 - 重新启动服务器。
-
python manage.py migrate app - fake 0001
-
python manage.py migrate应用程序
- 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
这篇关于向南加入Django项目,开发和生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!