向南加入Django项目,开发和生产 [英] Adding South to Django project, development & production

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

问题描述

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

推荐答案

我的指南说:


  1. 在服务器上安装South。 c code code code code code code $ c < 到 INSTALLED_APPS settings.py

  2. 上传 settings.py

  3. 重新启动服务器

  4. python manage.py syncdb

  5. 上传新的 app / models.py 应用/迁移/ dir。

  6. 重新启动服务器。

  7. python manage.py migrate app - fake 0001

  8. python manage.py migrate应用程序

  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

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

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