Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it a good programming practice to separate models from the rest of the application

My project consists of several django applications that need to be deployed differently, possibly on different machines. However often these apps occasionally need to access each other's models, so I was thinking of "externalizing" my models so that they can be accessed more elegantly from any app. So the idea is to do have directory structure resembling something like this:

/ 
+ application1
+ application2
+ models

Is there a functional point to doing that (other than code maintainability), since the applications can cross-reference each other?

like image 913
Goro Avatar asked Jan 12 '12 00:01

Goro


1 Answers

The following paragraph in the django book makes me think that that's probably not a good idea (I added the bold formatting):

However, there’s one requirement regarding the app convention: if you’re using Django’s database layer (models), you must create a Django app. Models must live within apps. Thus, in order to start writing our models, we’ll need to create a new app.

like image 166
jcollado Avatar answered Sep 30 '22 15:09

jcollado