I'm currently working on a django project which tends to get pretty complex in time. Therefore I'm planning to encapsulate basic core models and utilities that are going to be reused throughout the application in a separate space. Since these models are mostly base models needed by other apps, imho there's no need to create a django app and instead place them in an standard python package (so the package is acting just like a simple library).

Since I'm using south for migrations I'm running into problems when not creating an app and instead use my 'library', because south only considers apps for migrations.

What is the django way to avoid this 'problem' and to be able to also create migrations for my core models?

有帮助吗?

解决方案

Well... the answer is to use apps.

That's what they're for. They were designed the way the are exactly because standard modules don't provide the level of integration needed.

If you start hacking away on your library to make it work on its own, you'll end up with mess of code and glue about the same size of a django app, but with considerably worse smell.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top