settings.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. """
  2. Django settings for webapps project.
  3. For more information on this file, see
  4. https://docs.djangoproject.com/en/1.7/topics/settings/
  5. For the full list of settings and their values, see
  6. https://docs.djangoproject.com/en/1.7/ref/settings/
  7. """
  8. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  9. import os
  10. import ConfigParser
  11. BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  12. STATIC_ROOT = 'staticfiles'
  13. STATIC_URL = '/static/'
  14. STATICFILES_DIRS = (
  15. os.path.join(BASE_DIR, 'static'),
  16. )
  17. # Honor the 'X-Forwarded-Proto' header for request.is_secure()
  18. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  19. # Quick-start development settings - unsuitable for production
  20. # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
  21. # SECURITY WARNING: keep the secret key used in production secret!
  22. SECRET_KEY = 'hsz$%9_4jak+skd%7cr)cfku+n!1t0hn#fn_e=y+!69flp@1x0'
  23. # SECURITY WARNING: don't run with debug turned on in production!
  24. DEBUG = True
  25. TEMPLATE_DEBUG = True
  26. ALLOWED_HOSTS = ['*']
  27. INSTALLED_APPS = (
  28. 'django.contrib.admin',
  29. 'django.contrib.auth',
  30. 'django.contrib.contenttypes',
  31. 'django.contrib.sessions',
  32. 'django.contrib.messages',
  33. 'django.contrib.staticfiles',
  34. 'socialnetwork'
  35. )
  36. MIDDLEWARE_CLASSES = (
  37. 'django.contrib.sessions.middleware.SessionMiddleware',
  38. 'django.middleware.common.CommonMiddleware',
  39. 'django.middleware.csrf.CsrfViewMiddleware',
  40. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  41. 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  42. 'django.contrib.messages.middleware.MessageMiddleware',
  43. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  44. )
  45. # Used by the authentication system for the private-todo-list application.
  46. # URL to use if the authentication system requires a user to log in.
  47. LOGIN_URL = '/socialnetwork/login'
  48. # Default URL to redirect to after a user logs in.
  49. LOGIN_REDIRECT_URL = '/socialnetwork/'
  50. ROOT_URLCONF = 'webapps.urls'
  51. WSGI_APPLICATION = 'webapps.wsgi.application'
  52. # DATABASES = {
  53. # 'default': {
  54. # 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
  55. # 'NAME': 'hw7', # Or path to database file if using sqlite3.
  56. # # The following settings are not used with sqlite3:
  57. # 'USER': 'hw7',
  58. # 'PASSWORD': 'hw7',
  59. # 'HOST': 'localhost', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
  60. # 'PORT': '', # Set to empty string for default.
  61. # }
  62. # }
  63. # Database
  64. # https://docs.djangoproject.com/en/1.7/ref/settings/#databases
  65. import dj_database_url
  66. DATABASES={}
  67. DATABASES['default'] = dj_database_url.config()
  68. DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
  69. # Internationalization
  70. # https://docs.djangoproject.com/en/1.7/topics/i18n/
  71. LANGUAGE_CODE = 'en-us'
  72. TIME_ZONE = 'America/New_York'
  73. USE_I18N = True
  74. USE_L10N = True
  75. USE_TZ = True
  76. FILE_UPLOAD_MAX_MEMORY_SIZE = 2500000
  77. #EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  78. config = ConfigParser.ConfigParser()
  79. config.read("config.ini")
  80. EMAIL_HOST = os.environ.get('Host')
  81. EMAIL_PORT = os.environ.get('Port')
  82. EMAIL_HOST_USER = os.environ.get('User')
  83. EMAIL_HOST_PASSWORD = os.environ.get('Password')
  84. EMAIL_USE_SSL = True