How to keep all my django applications in specific folder How to keep all my django applications in specific folder django django

How to keep all my django applications in specific folder


You can add your apps folder to your python path by inserting the following in your settings.py:

import osimport sysPROJECT_ROOT = os.path.dirname(__file__)sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps'))

Then you can use all the apps in this folder just in the same way as they were in your project root!


You can do this very easily, but you need to change the settings.py to look like this:

INSTALLED_APPS = (    'apps.app1',    'apps.app2',    # ...)

And your urls.py to look like this:

urlpatterns = patterns('',     (r'^app1/',include('apps.app1')),        (r'^app2/',include('apps.app2')),    )

.. and modify any imports to point to the app location


How about you utilize the BASE_DIR variable already present in the settings.py.

Just add the following:

import syssys.path.insert(0, os.path.join(BASE_DIR, 'apps'))

Hope this helps.