django-south

Django - South - Is There a way to view the SQL it runs?

南楼画角 提交于 2019-12-02 20:17:48
Here's what I want to do. Develop a Django project on a development server with a development database. Run the south migrations as necessary when I change the model. Save the SQL from each migration, and apply those to the production server when I'm ready to deploy. Is such a thing possible with South? (I'd also be curious what others do to get your development database changes on production when working with Django) Lutger You can at least inspect the sql generated by doing manage.py migrate --db-dry-run --verbosity=2 . This will not do anything to the database and will show all the sql. I

How to reset south migrations to capture the current state of my django models

烈酒焚心 提交于 2019-12-02 19:42:56
I have an app that currently has 35 south migrations. These take a while to go through when setting up a new deployment (we create new deployments often), and the app is continually evolving--adding more migrations. Additionally, the migrations include some potentially complex data migrations and a few custom migrations that break SQLite3 (not a huge problem right now since everything is on Postgres, but its nice to be able to set up a quick test environment), and generally just more things that can go wrong. All of our deployments and developers are up to date, and I'd like to clear out all

django loading data from fixture after backward migration / loaddata is using model schema not database schema

三世轮回 提交于 2019-12-02 19:35:49
I have recenty came across a problem while importing older data than my current model schema. Flow which I use and lead to error: dumpdata with python manage.py dumpdata -> 0002 make some modifications to model generate migration with python manage.py schemamigration app_name --auto -> 0003 run migration play with database migrate to 0002 loaddata generate SQL in which I have current (migration 0003) fields, and cause failing loaddata process (mpoly is added field) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self

Database migrations on django production

ぐ巨炮叔叔 提交于 2019-12-02 17:15:27
From someone who has a django application in a non-trivial production environment, how do you handle database migrations? I know there is south , but it seems like that would miss quite a lot if anything substantial is involved. The other two options (that I can think of or have used) is doing the changes on a test database and then (going offline with the app) and importing that sql export. Or, perhaps a riskier option, doing the necessary changes on the production database in real-time, and if anything goes wrong reverting to the back-up. How do you usually handle your database migrations

Testing Django apps that use South migrations

南笙酒味 提交于 2019-12-02 17:07:25
I'm trying to create some Functional tests for a Django app that uses South migrations. Eventually, I will also be creating Twill tests. When I try to run the existing tests, the test database is not created successfully because of a problem with the South migrations. ( Fails @ 7th of 58 migrations ) It would seem that for the purpose of testing, it's better to build the test database from the Django models, like a syncdb would, than from South. How do I set up the Django test suite to build the test database from the current model vs. trying to use South? Leopd The South setting SOUTH_TESTS

South migration for social auth

大兔子大兔子 提交于 2019-12-02 16:16:13
问题 I am using south in my django project. I just added social_auth in settings.py, when i run this command: python manage.py schemamigration social_auth --auto It says: Nothing seems to have changed. Please let me know how can i create tables for social auth, as by this command the table is not getting created. 回答1: I don't think you need to generate migrations for social_auth, since this app should already have its migrations. Rather, you need to execute them, so after you added 'social_auth'

django no such table:

主宰稳场 提交于 2019-12-02 15:29:13
I have models in Django set up as below. class Pupil(models.Model): forename = models.CharField(max_length=30) surname = models.CharField(max_length=30) dateofbirth = models.DateField() year = models.IntegerField() class_group = models.CharField(max_length=30) email = models.EmailField(blank=True) assignments = models.ManyToManyField('Assignment', verbose_name='related assignments') def __unicode__(self): return u'%s %s' % (self.forename, self.surname) class Subject(models.Model): name = models.CharField(max_length=30) level = models.CharField(max_length=30) teachers = models.ManyToManyField(

Adding new custom permissions in Django

自古美人都是妖i 提交于 2019-12-02 14:03:59
I am using custom permissions in my Django models like this: class T21Turma(models.Model): class Meta: permissions = (("can_view_boletim", "Can view boletim"), ("can_view_mensalidades", "Can view mensalidades"),) The problem is that when I add a permission to the list it doesn't get added to the auth_permission table when I run syncdb. What am I doing wrong. If it makes any difference I am using south for database migrations. South does not track django.contrib.auth permissions. See ticket #211 for more information. One of the comments on the ticket suggests that using the --all option on

South migration for social auth

主宰稳场 提交于 2019-12-02 09:36:48
I am using south in my django project. I just added social_auth in settings.py, when i run this command: python manage.py schemamigration social_auth --auto It says: Nothing seems to have changed. Please let me know how can i create tables for social auth, as by this command the table is not getting created. I don't think you need to generate migrations for social_auth, since this app should already have its migrations. Rather, you need to execute them, so after you added 'social_auth' in your settings you have to run only this command: python manage.py migrate social_auth django-social-auth

Does core django supports migration without django-south or similar app?

依然范特西╮ 提交于 2019-12-02 06:53:04
问题 Does django consists of a migration concept without south app ? If not why didn't they include it in Django 1.4 ? [ Since, its a must have ] Please help.. 回答1: No, it doesn't. South is considered as the 'de facto' standard for database migration in Django. Further reading can be found in the Django development wiki. From the version 1.2 release notes: Contrib-01 (Add South to contrib) - general consensus - including that of South's lead developer - is that South isn't yet ready to be a