MIGRATION_MODULES correct setup.

209 views
Skip to first unread message

b.w...@thelinguist.com

unread,
Aug 19, 2015, 4:00:50 PM8/19/15
to Django users
Hi we have a farily large Django 1.8 project and there are a few 3rd party apps we are using that don't have Django migrations so I am trying to create ones for the apps in question.

In my settings file I have:

MIGRATION_MODULES = {

    'oauth_access': 'thirdparty_migrations.oauth_access_migrations',

}


Some background we are using buildout to handle dependancies. Now what stumps me is for some reason when running make migrations oath_access the module is being created under the ipython egg. This happens regardless of where I put my own module of thirdparty_migrations it just ignores it.


Is there some other setting that I am missing to specify the location for a 3rd party migration?


--

Bruce

b.w...@thelinguist.com

unread,
Aug 20, 2015, 10:02:04 AM8/20/15
to Django users
I believe the cause of this is line 248 in django/db/migrations/writer.py 

create_path = os.path.join(upath(sys.path[0]), *package_dirs)


Which is automatically using the first path location in the system path list. Unfortunately with the way our buildout handles paths this is causing a problem:


In manage.py:

import sys

sys.path[0:0] = [

  '/vagrant/eggs/ipython-3.0.0-py2.7.egg',  # This is where the MIGRATION_MODULES is creating the app specific migration package.

  '/vagrant/eggs/httplib2-0.9.1-py2.7.egg',

  '/vagrant/eggs/oauth2-1.5.211-py2.7.egg',

  ...

]


This looks to be a bug to me because there is no guarantee the first path location is the one you want this package to be created in.


--

Bruce

Tim Graham

unread,
Aug 20, 2015, 12:53:03 PM8/20/15
to Django users

b.w...@thelinguist.com

unread,
Aug 20, 2015, 1:56:09 PM8/20/15
to Django users
Thanks Tim, that looks to be the exact situation I am facing. 
Reply all
Reply to author
Forward
0 new messages