Fakultas Ilmu Komputer UI

settings.py 4.26 KB
Newer Older
Zamil Majdy's avatar
Zamil Majdy committed
1
import os
2
import sys
Zamil Majdy's avatar
Zamil Majdy committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'assets'), # We do this so that django's collectstatic copies or our bundles to the STATIC_ROOT or syncs them to whatever storage we use.
)

WEBPACK_LOADER = {
    'DEFAULT': {
        'BUNDLE_DIR_NAME': 'bundles/',
        'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json'),
    }
}

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'gz!k*@!n8h$yny1)zp!e5#w8!s4%*wqnur5$qnr@$*xx_o+aij'

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

Zamil Majdy's avatar
Zamil Majdy committed
23
ALLOWED_HOSTS = [u'bot.recruit.id',u'kape.recruit.id',u'104.236.76.161',u'localhost',u'127.0.0.1']
Zamil Majdy's avatar
Zamil Majdy committed
24
25
26
27
28
29
30
31
32
33
34
35
36


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'webpack_loader',
    'core',
37
38
    'rest_framework',
    'django_nose',
39
    'rest_framework_swagger',
40
41
    'silk',
    'django_filters'
Zamil Majdy's avatar
Zamil Majdy committed
42
43
44
45
46
47
48
49
50
51
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
52
    'silk.middleware.SilkyMiddleware',
Zamil Majdy's avatar
Zamil Majdy committed
53
54
55
56
]

ROOT_URLCONF = 'kape.urls'

57
58
59
60
61
62
# Use nose to run all tests
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

# Tell nose to measure coverage on the 'foo' and 'bar' apps
NOSE_ARGS = [
    '--with-coverage',
63
    '--cover-package=core.views',
64
    '--cover-html-dir=test/backend',
65
66
67
68
    '--cover-html'
    ''
]

Zamil Majdy's avatar
Zamil Majdy committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'kape.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases

DATABASES = {
    'default': {
93
94
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'kape',
95
96
        'USER': 'kape',
        'PASSWORD': 'kape',
97
98
        'HOST': 'localhost',
        'PORT': '',
Zamil Majdy's avatar
Zamil Majdy committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    }
}


# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/

139
STATIC_URL = '/assets/'
root's avatar
root committed
140
STATIC_ROOT = '/home/assets'
141
142
MEDIA_URL = '/files/'
MEDIA_ROOT = '/home/files'
143
144
145
146
147
148

REST_FRAMEWORK = {
    # Use Django's standard `django.contrib.auth` permissions,
    # or allow read-only access for unauthenticated users.
    'DEFAULT_PERMISSION_CLASSES': [
        'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
149
150
    ],
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
151
    'PAGE_SIZE': 10,
152
    'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',)
153
154
155
156
157
158
159
}

GZIP_CONTENT_TYPES = (
    'text/css',
    'application/javascript',
    'application/x-javascript',
    'text/javascript'
root's avatar
root committed
160
)
161
162

SESSION_COOKIE_HTTPONLY = False
163

root's avatar
root committed
164
RUNNING_DEVSERVER = (len(sys.argv) > 1 and sys.argv[1] == 'runserver')
165

166
API_CS_CREDENTIALS = {'user': 'kape', 'password': 'yukcarikape'}
167