Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Collection of Practice
2019
1606875806-practice
Commits
d70a618d
Commit
d70a618d
authored
Sep 15, 2019
by
Izzan Fakhril Islam
Browse files
updating settings and project requirements
parent
f9bcb53c
Changes
2
Hide whitespace changes
Inline
Side-by-side
requirements_2.txt
View file @
d70a618d
...
...
@@ -15,3 +15,6 @@ requests
requests-mock
django-filter
selenium
whitenoise==4.1
django-environ==0.4.5
dj-database-url
tutorial/settings.py
View file @
d70a618d
...
...
@@ -11,10 +11,15 @@ https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import
os
import
socket
import
dj_database_url
import
psycopg2
import
environ
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
PRODUCTION
=
os
.
environ
.
get
(
'DATABASE_URL'
)
is
not
None
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
...
...
@@ -25,8 +30,7 @@ SECRET_KEY = 'j)q+0fwr=#m&b^(kwzdk3v&ri0vs&f-*kwrma+k38v)jm^gznm'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
True
ALLOWED_HOSTS
=
[]
ALLOWED_HOSTS
=
[
'*'
]
# Application definition
...
...
@@ -54,7 +58,7 @@ ROOT_URLCONF = 'tutorial.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
)
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
@@ -69,17 +73,28 @@ TEMPLATES = [
WSGI_APPLICATION
=
'tutorial.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
os
.
path
.
join
(
BASE_DIR
,
'db.sqlite3'
),
DATABASES
=
{}
if
PRODUCTION
:
DATABASE_URL
=
os
.
environ
[
'DATABASE_URL'
]
conn
=
psycopg2
.
connect
(
DATABASE_URL
,
sslmode
=
'require'
)
DATABASES
[
'default'
]
=
dj_database_url
.
config
(
conn_max_age
=
800
,
ssl_require
=
True
)
else
:
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.postgresql_psycopg2'
,
'NAME'
:
'postgres'
,
'USER'
:
'postgres'
,
'PASSWORD'
:
'connected'
,
'HOST'
:
'localhost'
,
'PORT'
:
'5432'
,
'OPTIONS'
:
{
'options'
:
'-c search_path=tutorialpmpl'
}
}
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
...
...
@@ -105,7 +120,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE
=
'en-us'
TIME_ZONE
=
'
UTC
'
TIME_ZONE
=
'
Asia/Jakarta
'
USE_I18N
=
True
...
...
@@ -113,8 +128,11 @@ USE_L10N = True
USE_TZ
=
True
PROJECT_ROOT
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_ROOT
=
os
.
path
.
join
(
PROJECT_ROOT
,
'static'
)
STATIC_URL
=
'/static/'
STATICFILES_STORAGE
=
'whitenoise.storage.CompressedManifestStaticFilesStorage'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment