Fakultas Ilmu Komputer UI

Commit 7d8289a0 authored by Muhammad Ilham Peruzzi's avatar Muhammad Ilham Peruzzi
Browse files

Merge branch 'master' of...

Merge branch 'master' of gitlab.cs.ui.ac.id:pmpl/practice-collection/2019/1606823475-practice into testinggoat/ch4-5
parents a8449158 43a4b86e
Pipeline #20943 passed with stages
in 9 minutes and 46 seconds
#!/bin/bash
python manage.py makemigrations
python manage.py migrate
\ No newline at end of file
python manage.py migrate
......@@ -11,13 +11,17 @@ https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
import psycopg2
import dj_database_url
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'ex5rgq_jg@bc653ieniy@=)n%x6ek^3-e)n=o7^i#4z%rvu7zp'
......@@ -25,7 +29,7 @@ SECRET_KEY = 'ex5rgq_jg@bc653ieniy@=)n%x6ek^3-e)n=o7^i#4z%rvu7zp'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ["*"]
ALLOWED_HOSTS = ['*']
# Application definition
......@@ -37,7 +41,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'lists',
'lists'
]
MIDDLEWARE = [
......@@ -48,7 +52,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ROOT_URLCONF = 'superlists.urls'
......@@ -73,7 +77,7 @@ WSGI_APPLICATION = 'superlists.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
'default': {
......@@ -82,9 +86,18 @@ DATABASES = {
}
}
# Use PostgreSql as default database on production
DATABASE_URL = os.environ.get('DATABASE_URL')
if DATABASE_URL is not None:
print("Database URL", DATABASE_URL)
conn = psycopg2.connect(DATABASE_URL, sslmode='require')
DATABASES['default'] = dj_database_url.config(conn_max_age=600,
ssl_require=True)
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
......@@ -103,7 +116,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
# https://docs.djangoproject.com/en/2.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
......@@ -117,8 +130,8 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
\ No newline at end of file
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment