Saturday, 5 November 2011

Portable Apps in django - Share Apps

How to Share Applications in django to be shared among multiple projects?

This Questions comes into mind because one Projects consist one or many Applications and any application can be used in multiple projects as well. like blog app can be shared among multiple projects. to do this you need to copy app to Python Site-packages So you could simple add in Settings/Installed App by using there Name or Make another Folder of Apps and add that Folder to Python Path. To Add Apps Folder to Python Path. Edit Settings.py and Add Following Lines on to of it

DEVELOPMENT = True
if DEVELOPMENT:
    import sys
    sys.path.append('Path to Apps/Apps')

and if your Apps Folder Reside where your Projects are then you can edit above code as

DEVELOPMENT = True
if DEVELOPMENT:
    import sys
    sys.path.append(os.path.join(os.path.dirname(__file__), "../Apps"))

* Remember do not forget to Remove DEVELOPMENT = False or Remove above Code When Deploying Project of Server

Please share your comments below.

No comments:

Post a Comment