tags:

views:

60

answers:

1

When building a Django project its common to use many pre-built apps. For example, for tinymce or open-id.

It would be nice to keep these separated from project-specific apps.

My idea would be to create an "addons" directory/module in the project.

It should then be possible to use:

from addons.tinymce import models

However, tinymce's code uses, eg:

from tinymce import models

So my solution would be to add "addons" to sys.path in settings.py:

import sys, os
sys.path = [os.path.join(os.path.dirname(__file__), 'addons')] + sys.path

Does all that seem sensible? Is there a better way?

+3  A: 

You can arange your addons however you like. All you need to do is to add the addons folder to your python path. That way you can still just do

from tinymce import models

but your addons will be organized. A project is no more than a folder added to your python path anyways.

googletorp