Is it possible to change the 'migrations' folder's location outside of the Django project?

主宰稳场 提交于 2021-01-02 13:15:13

问题


what i'm trying to do is to change the default path for migrations for a specific application in a django project to put it outside the project itself but keeping it transparent, keeping use of makemigrations and migrate. Is it possible? if yes, how?


回答1:


Django has a MIGRATION_MODULES setting. It allows you to specify a different module for migrations per app. The module can be outside of the Django project, it just needs to be on your python path.

MIGRATION_MODULES = {'myapp': 'othermodule.db_migrations'}


来源:https://stackoverflow.com/questions/46486260/is-it-possible-to-change-the-migrations-folders-location-outside-of-the-djang

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