PageRenderTime 42ms CodeModel.GetById 31ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/manage.py

https://bitbucket.org/bconstantin/django_polymorphic/
Python | 29 lines | 18 code | 6 blank | 5 comment | 4 complexity | 9a0514f4a3929e2e644f93963ca30d44 MD5 | raw file
 1#!/usr/bin/env python
 2
 3# Prepend project subdirectory 'libraries-local' to sys.path.
 4# This allows us to use/test any version of Django
 5# (e.g. Django 1.2 subversion) or any other packages/libraries.
 6import sys, os
 7project_path = os.path.dirname(os.path.abspath(__file__))
 8libs_local_path = os.path.join(project_path, 'libraries-local')
 9if libs_local_path not in sys.path: sys.path.insert(1, libs_local_path)
10
11sys.stderr.write( 'using Python version: %s\n' % sys.version[:5])
12
13import django
14sys.stderr.write( 'using Django version: %s, from %s\n' % (
15        django.get_version(),
16        os.path.dirname(os.path.abspath(django.__file__))) )
17
18# vanilla Django manage.py from here on:
19
20from django.core.management import execute_manager
21try:
22    import settings # Assumed to be in the same directory.
23except ImportError:
24    import sys
25    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__)
26    sys.exit(1)
27
28if __name__ == "__main__":
29    execute_manager(settings)