django-south

Database migrations on django production

↘锁芯ラ 提交于 2019-12-03 03:51:21
问题 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

Changing Django database backend from MySql to PostgreSQL

微笑、不失礼 提交于 2019-12-03 03:48:28
I use Django 1.2 and 1.3 and MySql backends. Once in while a get an error message when migrating my MySql database with South: ! Error found during real run of migration! Aborting. ! Since you have a database that does not support running ! schema-altering statements in transactions, we have had ! to leave it in an interim state between migrations. ... ! The South developers regret this has happened, and would ! like to gently persuade you to consider a slightly ! easier-to-deal-with DBMS I was wondering if migrating my databases from MySql to PostgreSQL might prevent this error. Secondly,

Testing Django apps that use South migrations

前提是你 提交于 2019-12-03 03:38:11
问题 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

Django South - turning a null=True field into a null=False field

我怕爱的太早我们不能终老 提交于 2019-12-03 03:35:57
My question is, what is the best practice for turning a null=True field into a null=False field using Django South. Specifically, I'm working with a ForeignKey . You should write first a data migration: http://south.aeracode.org/docs/tutorial/part3.html and then make the schemamigration. If you want to turn nullable ForeignKey into non-nullable one, then it can be problematic if you have any rows with NULL for that field (column). In such case you need to either remove or fix them - possibly with custom data migration, like diegueus9 mentioned in the other answer. But if you don't have any

What does a South datamigration do compared to a schemamigration?

喜夏-厌秋 提交于 2019-12-03 02:41:05
I recently began digging into the South documentation and discovered that it had two distinct types of migrations: schemamigration datamigration As a result of my ignorance, I've always used schemamigrations for everything. In other words, even if I had something that was truly a "data migration", I'd simply used South's schemamigration to convert the data (with no apparent consequences). As I read the documentation, I'm not seeing a fault in this approach. Does anyone know the fundamental difference between the two migrations and what I may be missing by sticking with schemamigrations? There

Django 1.8 - what's the difference between migrate and makemigrations?

纵饮孤独 提交于 2019-12-03 02:38:56
问题 According to the documentation here: https://docs.djangoproject.com/en/1.8/topics/migrations/ it says: migrate, which is responsible for applying migrations, as well as unapplying and listing their status. and makemigrations, which is responsible for creating new migrations based on the changes you have made to your models. From what I understand, I first do makemigrations to create the migration file and then do migrate to actually apply the migration? Do note though that I just began my

django no such table:

岁酱吖の 提交于 2019-12-03 01:32:40
问题 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 =

What is a Django South GhostMigrations exception and how do you debug it?

前提是你 提交于 2019-12-03 01:21:14
Made some changes to my Django app's model and used South to migrate them on my development machine (migrations 0004 through 0009). But when trying to migrate these changes on the server, I get a "GhostMigrations" error. There isn't much good content explaining what a ghost migration is, or how to debug one. Google wasn't helpful on this one and the other SO questions mentioning ghost migrations don't cover this either (the most helpful question here was mostly about workflow). The helpful folks over in the django-south IRC had this to say about ghost migrations: "it means south's history (a

Disable Django South when running unit tests?

て烟熏妆下的殇ゞ 提交于 2019-12-03 00:57:11
Disable Django South when running unit tests? How do you avoid running all of the south migrations when doing django unit testing? Yes, the South documentation describes how to do it, but basically just add this to your settings.py file: SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead SKIP_SOUTH_TESTS = True # To disable South's own unit tests Even though, you have selected the good answer, I think that you should consider the option SOUTH_TESTS_MIGRATE instead. It will prevent to run all the migrations on your test db, and run syncdb instead. 来源: https:/

South + Django 1.4 Database error

可紊 提交于 2019-12-02 22:06:35
I have just installed my Django project on a new system, and installed Django 1.4. However when I try to run manage.py runserver or manage.py syncdb I get this error from South: Validating models... Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x1a67810>> Traceback (most recent call last): File "/home/saul/.virtualenvs/canada/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 91, in inner_run self.validate(display_num_errors=True) File "/home/saul/.virtualenvs