将 South 添加到 Django 项目、开发和生产 [英] Adding South to Django project, development & production

查看:15
本文介绍了将 South 添加到 Django 项目、开发和生产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将 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?

推荐答案

我的向导说:

  1. 在服务器上安装 South.import south from shell 只是为了确保您使用的是相同的 python 环境.
  2. settings.py 中将 'south' 添加到 INSTALLED_APPS.
  3. 上传settings.py.
  4. 重启服务器
  5. python manage.py syncdb.
  6. 上传新的 app/models.pyapp/migrations/ 目录.
  7. 重启服务器.
  8. python manage.py migrate app --fake 0001
  9. python manage.py 迁移应用
  1. Install South on server. import south from shell just to make sure you are using the same python env.
  2. Add 'south' to INSTALLED_APPS in settings.py.
  3. Upload settings.py.
  4. Restart server
  5. python manage.py syncdb.
  6. Upload new app/models.py and app/migrations/ dir.
  7. Restart server.
  8. python manage.py migrate app --fake 0001
  9. python manage.py migrate app

这篇关于将 South 添加到 Django 项目、开发和生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆