Adding South to Django project, development & production

落花浮王杯 提交于 2019-12-18 10:55:22

问题


Adding South to an existing Django project. I have it installed on both the development machine and the "production" server.

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

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?

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:


My guide says:

  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



回答2:


To make sure the south migration table exists,

python manage.py syncdb

and then

python manage.py migrate myproject.myapp --fake 0001
python manage.py migrate myproject.myapp

That's what's worked for me. :)




回答3:


No need to do this in Django >= 1.7
i am stuck on this more then 1 hour :)
and at last find 1.7 and more have in build upgrading-from-south

for more info https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south
may be this one help you



来源:https://stackoverflow.com/questions/4035296/adding-south-to-django-project-development-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!