| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | from django.core.management import execute_manager |
|---|
| 3 | import os |
|---|
| 4 | import sys |
|---|
| 5 | |
|---|
| 6 | LIBS = ( |
|---|
| 7 | # tuple for path, where each element is an element of tuple |
|---|
| 8 | # libs/django -> ('django',) |
|---|
| 9 | # libs/foo/bar -> ('foo', 'bar') |
|---|
| 10 | ('django-staticmedia-0.2.2',), |
|---|
| 11 | ('django-simple-captcha-0.1.7',), |
|---|
| 12 | ('twilix',), |
|---|
| 13 | ) |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | proj_root = os.path.dirname(os.path.abspath(__file__)) |
|---|
| 17 | |
|---|
| 18 | # add third-party libs to sys.path |
|---|
| 19 | for lib in LIBS: |
|---|
| 20 | libdir = os.path.join(proj_root, 'libs', *lib) |
|---|
| 21 | if os.path.isdir(libdir) and libdir not in sys.path: |
|---|
| 22 | sys.path.insert(0, libdir) |
|---|
| 23 | |
|---|
| 24 | try: |
|---|
| 25 | import settings # Assumed to be in the same directory. |
|---|
| 26 | except ImportError: |
|---|
| 27 | raise |
|---|
| 28 | import sys |
|---|
| 29 | sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) |
|---|
| 30 | sys.exit(1) |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | if __name__ == "__main__": |
|---|
| 34 | execute_manager(settings) |
|---|