3

I'm using the Django Activity Stream third party app from a Easy Install / Pip .egg file. This specific app requires tables to be constantly changed and updated as changes in the rest of my project is made, and as I need extra streams on new models.

If I want to use South to help me track and update these changes, what are my options? Is the only option to copy the external app directory into my project directory, thereby making the upkeep of my different Django projects slightly more difficult? I found this related question, but that does not really answer the case for when you are running from egg.

Simply put, all I need is South to use a separate migrations directory within my project that I specify. Is this possible to do with South?

Update

Well, I thought I had the answer by doing this in settings.py:

SOUTH_MIGRATION_MODULES = {
    'books': 'myproject.app_name.migrations',
}

But now South complains that

The migration module specified for actstream, 'myproject.app_name.migrations', is invalid; the parent module does not exist.

I created an empty folder for the app inside my project, along with an __init__.py, but this made no difference. What am I doing wrong?

Community
  • 1
  • 1
Herman Schaaf
  • 46,821
  • 21
  • 100
  • 139

1 Answers1

4

The answer finally was to do this in settings.py:

SOUTH_MIGRATION_MODULES = {
    'books': 'myproject.app_name.migrations',
}

But, since I was using site.addsitedir(path('apps')) to add the directory where my apps reside to the python path, I didn't need the myproject part. But of course, as soon as you remove the myproject part, South again uses the egg-installed version of the app. My solution was therefore simply to create a new directory in my project, called migrations (remember the __init__.py), and changed settings.py like so:

SOUTH_MIGRATION_MODULES = {
    'books': 'myproject.migrations.app_name.migrations',
}

The migrations directory can now keep any third-party app migrations.

Herman Schaaf
  • 46,821
  • 21
  • 100
  • 139