Skip to content

Commit 2e07fa5

Browse files
committed
update settings.py
1 parent b5b05df commit 2e07fa5

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

gettingstarted/settings.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@
1212
import os
1313
import dj_database_url
1414

15+
16+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1517
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
1618

1719

1820
# Quick-start development settings - unsuitable for production
19-
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
21+
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
2022

2123
# SECURITY WARNING: keep the secret key used in production secret!
22-
DEFAULT_SECRET_KEY = '3iy-!-d$!pc_ll$#$elg&cpr@*tfn-d5&n9ag=)%#()t$$5%5^'
23-
SECRET_KEY = os.environ.get('SECRET_KEY', DEFAULT_SECRET_KEY)
24+
SECRET_KEY = 'i+acxn5(akgsn!sr4^qgf(^m&*@+g1@u^t@=8s@axc41ml*f=s'
2425

2526
# SECURITY WARNING: don't run with debug turned on in production!
2627
DEBUG = True
2728

2829
TEMPLATE_DEBUG = True
2930

30-
ALLOWED_HOSTS = []
31-
3231

3332
# Application definition
3433

@@ -47,6 +46,7 @@
4746
'django.middleware.common.CommonMiddleware',
4847
'django.middleware.csrf.CsrfViewMiddleware',
4948
'django.contrib.auth.middleware.AuthenticationMiddleware',
49+
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
5050
'django.contrib.messages.middleware.MessageMiddleware',
5151
'django.middleware.clickjacking.XFrameOptionsMiddleware',
5252
)
@@ -57,44 +57,49 @@
5757

5858

5959
# Database
60-
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
61-
62-
# Parse database configuration from $DATABASE_URL
60+
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
6361

6462
DATABASES = {
65-
'default': dj_database_url.config(default='sqlite:///'+os.path.join(BASE_DIR, 'db.sqlite3'))
63+
'default': {
64+
'ENGINE': 'django.db.backends.sqlite3',
65+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
66+
}
6667
}
6768

6869
# Internationalization
69-
# https://docs.djangoproject.com/en/1.6/topics/i18n/
70+
# https://docs.djangoproject.com/en/1.7/topics/i18n/
7071

7172
LANGUAGE_CODE = 'en-us'
72-
7373
TIME_ZONE = 'UTC'
74-
7574
USE_I18N = True
76-
7775
USE_L10N = True
78-
7976
USE_TZ = True
8077

8178

82-
# Static files (CSS, JavaScript, Images)
83-
# https://docs.djangoproject.com/en/1.6/howto/static-files/
79+
# Parse database configuration from $DATABASE_URL
80+
DATABASES['default'] = dj_database_url.config()
8481

85-
STATIC_URL = '/static/'
82+
# Enable Connection Pooling (if desired)
83+
DATABASES['default']['ENGINE'] = 'django_postgrespool'
8684

8785
# Honor the 'X-Forwarded-Proto' header for request.is_secure()
8886
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
8987

9088
# Allow all host headers
9189
ALLOWED_HOSTS = ['*']
9290

93-
# Static asset configuration
91+
# Static files (CSS, JavaScript, Images)
92+
# https://docs.djangoproject.com/en/1.7/howto/static-files/
93+
9494
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
9595
STATIC_ROOT = 'staticfiles'
9696
STATIC_URL = '/static/'
9797

9898
STATICFILES_DIRS = (
9999
os.path.join(BASE_DIR, 'static'),
100100
)
101+
102+
# Simplified static file serving.
103+
# https://warehouse.python.org/project/whitenoise/
104+
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
105+

0 commit comments

Comments
 (0)