settings.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # Django settings for pyc project.
  2. DEBUG = True
  3. TEMPLATE_DEBUG = DEBUG
  4. ADMINS = (
  5. ('raylu', 'lurayl@gmail.com'),
  6. )
  7. MANAGERS = ADMINS
  8. DATABASES = {
  9. 'default': {
  10. 'ENGINE': 'django.db.backends.sqlite3', # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3', 'oracle'
  11. 'NAME': None,
  12. 'USER': '',
  13. 'PASSWORD': '',
  14. 'HOST': '',
  15. 'PORT': '',
  16. }
  17. }
  18. from os import path
  19. if path.exists('/home/dotcloud'):
  20. DATABASES['default']['NAME'] = '/home/dotcloud/pyc.db'
  21. else:
  22. DATABASES['default']['NAME'] = 'pyc.db'
  23. # Local time zone for this installation. Choices can be found here:
  24. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  25. # although not all choices may be available on all operating systems.
  26. # On Unix systems, a value of None will cause Django to use the same
  27. # timezone as the operating system.
  28. # If running in a Windows environment this must be set to the same as your
  29. # system time zone.
  30. TIME_ZONE = None
  31. # Language code for this installation. All choices can be found here:
  32. # http://www.i18nguy.com/unicode/language-identifiers.html
  33. LANGUAGE_CODE = 'en-us'
  34. SITE_ID = 1
  35. # If you set this to False, Django will make some optimizations so as not
  36. # to load the internationalization machinery.
  37. USE_I18N = True
  38. # If you set this to False, Django will not format dates, numbers and
  39. # calendars according to the current locale
  40. USE_L10N = True
  41. # Absolute filesystem path to the directory that will hold user-uploaded files.
  42. # Example: "/home/media/media.lawrence.com/media/"
  43. MEDIA_ROOT = path.expanduser('~/submissions')
  44. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  45. # trailing slash.
  46. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  47. MEDIA_URL = ''
  48. # Absolute path to the directory static files should be collected to.
  49. # Don't put anything in this directory yourself; store your static files
  50. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  51. # Example: "/home/media/media.lawrence.com/static/"
  52. STATIC_ROOT = ''
  53. # URL prefix for static files.
  54. # Example: "http://media.lawrence.com/static/"
  55. STATIC_URL = '/static/'
  56. # URL prefix for admin static files -- CSS, JavaScript and images.
  57. # Make sure to use a trailing slash.
  58. # Examples: "http://foo.com/static/admin/", "/static/admin/".
  59. ADMIN_MEDIA_PREFIX = '/static/admin/'
  60. # Additional locations of static files
  61. STATICFILES_DIRS = (
  62. # Put strings here, like "/home/html/static" or "C:/www/django/static".
  63. # Always use forward slashes, even on Windows.
  64. # Don't forget to use absolute paths, not relative paths.
  65. )
  66. # List of finder classes that know how to find static files in
  67. # various locations.
  68. STATICFILES_FINDERS = (
  69. 'django.contrib.staticfiles.finders.FileSystemFinder',
  70. 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  71. # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
  72. )
  73. # Make this unique, and don't share it with anybody.
  74. SECRET_KEY = '+*cyw@v9xprke!3s0ksj1mqj%-r6spy!weg5b#17#kufhwgb3z'
  75. # List of callables that know how to import templates from various sources.
  76. TEMPLATE_LOADERS = (
  77. 'django.template.loaders.filesystem.Loader',
  78. 'django.template.loaders.app_directories.Loader',
  79. # 'django.template.loaders.eggs.Loader',
  80. )
  81. MIDDLEWARE_CLASSES = (
  82. 'django.middleware.common.CommonMiddleware',
  83. 'django.contrib.sessions.middleware.SessionMiddleware',
  84. 'django.middleware.csrf.CsrfViewMiddleware',
  85. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  86. 'django.contrib.messages.middleware.MessageMiddleware',
  87. )
  88. ROOT_URLCONF = 'pyc.urls'
  89. TEMPLATE_DIRS = (
  90. # Don't forget to use absolute paths, not relative paths.
  91. path.join(path.dirname(__file__), 'templates'),
  92. )
  93. INSTALLED_APPS = (
  94. 'django.contrib.auth',
  95. 'django.contrib.contenttypes',
  96. 'django.contrib.sessions',
  97. 'django.contrib.sites',
  98. 'django.contrib.messages',
  99. 'django.contrib.staticfiles',
  100. 'django.contrib.admin',
  101. # Uncomment the next line to enable admin documentation:
  102. # 'django.contrib.admindocs',
  103. 'grader',
  104. )
  105. LOGIN_REDIRECT_URL = '/'
  106. LOGIN_URL = '/login'
  107. # A sample logging configuration. The only tangible logging
  108. # performed by this configuration is to send an email to
  109. # the site admins on every HTTP 500 error.
  110. # See http://docs.djangoproject.com/en/dev/topics/logging for
  111. # more details on how to customize your logging configuration.
  112. LOGGING = {
  113. 'version': 1,
  114. 'disable_existing_loggers': False,
  115. 'handlers': {
  116. 'mail_admins': {
  117. 'level': 'ERROR',
  118. 'class': 'django.utils.log.AdminEmailHandler'
  119. }
  120. },
  121. 'loggers': {
  122. 'django.request': {
  123. 'handlers': ['mail_admins'],
  124. 'level': 'ERROR',
  125. 'propagate': True,
  126. },
  127. }
  128. }