#!/usr/bin/env python
import os
import site
import sys

ROOT = os.path.dirname(os.path.abspath(__file__))
path = lambda *a: os.path.join(ROOT,*a)


# Adjust the python path and put local packages in front.
prev_sys_path = list(sys.path)

site.addsitedir(path('apps'))
site.addsitedir(path('lib'))

# Local (project) vendor library
site.addsitedir(path('vendor-local'))
site.addsitedir(path('vendor-local/lib/python'))

# Global (upstream) vendor library
site.addsitedir(path('vendor'))
site.addsitedir(path('vendor/lib/python'))


# Move the new items to the front of sys.path. (via virtualenv)
new_sys_path = []
for item in list(sys.path):
    if item not in prev_sys_path:
        new_sys_path.append(item)
        sys.path.remove(item)
sys.path[:0] = new_sys_path

from django.core.management import execute_manager
import settings

# Configure Celery
import djcelery
djcelery.setup_loader()

# Monkey-patch django forms to avoid having to use Jinja2's |safe everywhere.
import safe_django_forms
safe_django_forms.monkeypatch()

if __name__ == "__main__":
    execute_manager(settings)

@@ -889,16 +889,78 @@
 ader()%0A%0A
+if __name__ == %22__main__%22:%0A    execute_manager(settings)%0A%0A    
 # Monkey
@@ -1029,16 +1029,20 @@
 ywhere.%0A
+    
 import s
@@ -1058,16 +1058,20 @@
 o_forms%0A
+    
 safe_dja
@@ -1098,62 +1098,4 @@
 h()%0A
-%0Aif __name__ == %22__main__%22:%0A    execute_manager(settings)%0A

correct location of safe_django_forms import