· 7 years ago · Mar 09, 2018, 08:34 AM
1"""
2Django settings for my_site project.
3
4Generated by 'django-admin startproject' using Django 1.11.10.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.11/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.11/ref/settings/
11"""
12
13import os
14import pymysql
15
16# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
17BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18
19
20# Quick-start development settings - unsuitable for production
21# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
22
23# SECURITY WARNING: keep the secret key used in production secret!
24SECRET_KEY = '^6=pbaqiy9m^56&pcxrn4u4#c_q6d+26h#7juz2mtw1c6zllsb'
25
26# SECURITY WARNING: don't run with debug turned on in production!
27DEBUG = True
28
29ALLOWED_HOSTS = []
30
31
32# Application definition
33
34INSTALLED_APPS = [
35 'django.contrib.admin',
36 'django.contrib.auth',
37 'django.contrib.contenttypes',
38 'django.contrib.sessions',
39 'django.contrib.messages',
40 'django.contrib.staticfiles',
41 'blog',
42 'karyawan',
43 'kehadiran',
44 'homepage',
45]
46
47MIDDLEWARE = [
48 'django.middleware.security.SecurityMiddleware',
49 'django.contrib.sessions.middleware.SessionMiddleware',
50 'django.middleware.common.CommonMiddleware',
51 'django.middleware.csrf.CsrfViewMiddleware',
52 'django.contrib.auth.middleware.AuthenticationMiddleware',
53 'django.contrib.messages.middleware.MessageMiddleware',
54 'django.middleware.clickjacking.XFrameOptionsMiddleware',
55]
56
57ROOT_URLCONF = 'my_site.urls'
58
59TEMPLATES = [
60 {
61 'BACKEND': 'django.template.backends.django.DjangoTemplates',
62 'DIRS': ['templates'],
63 'APP_DIRS': True,
64 'OPTIONS': {
65 'context_processors': [
66 'django.template.context_processors.debug',
67 'django.template.context_processors.request',
68 'django.contrib.auth.context_processors.auth',
69 'django.contrib.messages.context_processors.messages',
70 ],
71 },
72 },
73]
74
75WSGI_APPLICATION = 'my_site.wsgi.application'
76
77
78# Database
79# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
80
81# DATABASES = {
82# 'default': {
83# 'ENGINE': 'django.db.backends.sqlite3',
84# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
85# }
86# }
87
88
89DATABASES = {
90 'default': {
91 'ENGINE': 'django.db.backends.mysql',
92 'NAME': 'py_django_mini_hrd',
93 'USER': 'root',
94 'PASSWORD': '',
95 'HOST': 'localhost',
96 'PORT': '3306',
97 }
98}
99
100# Password validation
101# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
102
103AUTH_PASSWORD_VALIDATORS = [
104 {
105 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
106 },
107 {
108 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
109 },
110 {
111 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
112 },
113 {
114 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
115 },
116]
117
118
119# Internationalization
120# https://docs.djangoproject.com/en/1.11/topics/i18n/
121
122LANGUAGE_CODE = 'en-us'
123
124TIME_ZONE = 'UTC'
125
126USE_I18N = True
127
128USE_L10N = True
129
130USE_TZ = True
131
132
133# Static files (CSS, JavaScript, Images)
134# https://docs.djangoproject.com/en/1.11/howto/static-files/
135
136STATIC_URL = '/static/'
137
138LOGIN_URL = '/login/'
139
140#START konfigurasi upload foto
141MEDIA_URL = '/media/'
142
143MEDIA_ROOT = os.path.join(BASE_DIR,"assets/")
144#END konfigurasi upload foto
145
146STATICFILES_DIRS = (
147 os.path.join(BASE_DIR, "assets"),
148)