Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make a Django app pluggable?

Say for example I have a Blog app that I want to be able to drop into different projects, but I always want the Blog to be associated with some other model. For example, in one case I may want it to be associated with a user:

site.com/someuser/blog

But on another site I want it to be associated with, say, a school:

site.com/someschool/blog

Is there a way to make the Blog app pluggable so that it's not necessary to redefine the model (adding a foreign key field) whenever I drop it into a project?

like image 252
rick Avatar asked May 04 '09 05:05

rick


1 Answers

There are several important details for making sure an app can be reusable and I think it's best to link to two of the more important sets of documentation on the topic:

  • django-best-practices
  • django-reusable-apps-docs
like image 83
Van Gale Avatar answered Oct 09 '22 09:10

Van Gale