suslov
suslov

Reputation: 129

Could Django project directory more simple structure with or without South?

I'm a new comer to Django.

However, I'm little confused on directory structure of Django. For instance I have to write so many models.py in different place, which, presumably, will cause difficulty to maintain the project in future. I want to make it more like real MVC structure, with every model files in a models directory.

Could it be possible to do that with using South, which seems to only looking at models.py, or should I consider different migration tools?

Upvotes: 3

Views: 261

Answers (2)

Anshuma
Anshuma

Reputation: 3472

I dont think there is a provision in django to put all models at one place. and also it is bad idea to put all at one place. because each app has its own DB Schema and putting apps independent is necessary to fulfill reusability factor. Its better to keep the models isolated from each other, attached to their app as it helps reausability.

South does not fulfill this. it just keeps track of ur Db migrations n fixtures.

At one point or the other, South comes into picture, no matter how perfectly the DB Schema is designed.

Upvotes: 2

cberner
cberner

Reputation: 3040

Django organizes code into 'apps', which is why you have separate models.py files, and I don't think there's a way to put them all in one directory instead, since each app gets its own Python package.

However, the way I normally structure my code, is to have one (or a few, if it's a larger project) app for all my code, since you can have as many Models in a single models.py file as you want.

I don't think South will help you with that, but it will make it a lot easier to manage your migrations, so I would highly recommend it.

Upvotes: 2

Related Questions