Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have been working a while on a Django project which has been growing a bit lately. I have been think a bit about what strategy to use to make it easier to handle. One thing I would like to get some input on would be if I should split my application into several smaller applications. That would make my view and model files smaller and separate some of the concerns.

One thing that bothers me with this is that in my applications I would have several helper methods that will be used across applications. Also some models will also have to be shared/used across applications. Would this make sense? This doesn't go well with the separation of concerns I was hoping to achieve by splitting my app in several smaller apps. What would be a good approach for sharing helper methods, models etc. across applications?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

If your project's getting large, think of apps as reusable modules. You can separate out the functionality that is shared across your apps into its own app.

See the discussions below for more thoughts on the matter:

When to create a new app (with startapp) in Django?

What is a Django “app” supposed to mean?

What is an “app” in Django?

share|improve this answer
    
What if an app needs to add some menu items to the project navigation? stackoverflow.com/questions/23405610 –  utapyngo May 1 at 15:54

I like to create a base/ app with no views and no moments for shared stuff.

One problem that can occur when you have models spread over multiple apps is circular imports. This can be avoided by using strings to refer to other models (foo = ForeignKey("someapp.Foo") instead of foo = ForeignKey(someapp.models.Foo)). Django lets you use strings like this in more places.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.