Initial commit

This commit is contained in:
Damillora 2020-01-15 21:09:07 +07:00
commit eb354d04b2
33 changed files with 909 additions and 0 deletions

89
.gitignore vendored Normal file
View File

@ -0,0 +1,89 @@
# Created by https://www.gitignore.io
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Sphinx documentation
docs/_build/
# PyBuilder
target/
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
.env
db.sqlite3

21
manage.py Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tugas.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

0
primary/__init__.py Normal file
View File

10
primary/admin.py Normal file
View File

@ -0,0 +1,10 @@
from django.contrib import admin
from primary.models import User, Rumah, Ruang, Item, DetailPenghuni, Akses
# Register your models here.
admin.site.register(User)
admin.site.register(Rumah)
admin.site.register(Ruang)
admin.site.register(Item)
admin.site.register(DetailPenghuni)
admin.site.register(Akses)

5
primary/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class PrimaryConfig(AppConfig):
name = 'primary'

View File

@ -0,0 +1,37 @@
# Generated by Django 3.0.2 on 2020-01-14 15:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Rumah',
fields=[
('RumahID', models.AutoField(primary_key=True, serialize=False)),
('NamaRumah', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='User',
fields=[
('UserID', models.AutoField(primary_key=True, serialize=False)),
('NamaUser', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Ruang',
fields=[
('RuangID', models.AutoField(primary_key=True, serialize=False)),
('NamaRuang', models.CharField(max_length=100)),
('Rumah', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='primary.Rumah')),
],
),
]

View File

@ -0,0 +1,28 @@
# Generated by Django 3.0.2 on 2020-01-14 15:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('primary', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DetailPenghuni',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Role', models.IntegerField()),
('Rumah', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='primary.Rumah')),
('User', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='primary.User')),
],
),
migrations.AddField(
model_name='rumah',
name='Penghuni',
field=models.ManyToManyField(through='primary.DetailPenghuni', to='primary.User'),
),
]

View File

@ -0,0 +1,41 @@
# Generated by Django 3.0.2 on 2020-01-14 15:45
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('primary', '0002_auto_20200114_1542'),
]
operations = [
migrations.CreateModel(
name='Akses',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('StatusAkses', models.BooleanField()),
],
),
migrations.CreateModel(
name='Item',
fields=[
('ItemID', models.AutoField(primary_key=True, serialize=False)),
('NamaItem', models.CharField(max_length=100)),
('StatusItem', models.BooleanField()),
('Pengguna', models.ManyToManyField(through='primary.Akses', to='primary.User')),
('Ruang', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='primary.Ruang')),
],
),
migrations.AddField(
model_name='akses',
name='Item',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='primary.Item'),
),
migrations.AddField(
model_name='akses',
name='User',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='primary.User'),
),
]

View File

37
primary/models.py Normal file
View File

@ -0,0 +1,37 @@
from django.db import models
# Create your models here.
class User(models.Model):
UserID = models.AutoField(primary_key=True)
NamaUser = models.CharField(max_length=100)
class Rumah(models.Model):
RumahID = models.AutoField(primary_key=True)
NamaRumah = models.CharField(max_length=100)
Penghuni = models.ManyToManyField(User, through='DetailPenghuni')
class Ruang(models.Model):
RuangID = models.AutoField(primary_key=True)
Rumah = models.ForeignKey(Rumah,on_delete=models.CASCADE,to_field='RumahID')
NamaRuang = models.CharField(max_length=100)
class DetailPenghuni(models.Model):
Rumah = models.ForeignKey(Rumah,on_delete=models.CASCADE,to_field='RumahID')
User = models.ForeignKey(User,on_delete=models.CASCADE,to_field='UserID')
Role = models.IntegerField()
class Item(models.Model):
ItemID = models.AutoField(primary_key=True)
Ruang = models.ForeignKey(Ruang,on_delete=models.CASCADE,to_field='RuangID')
NamaItem = models.CharField(max_length=100)
StatusItem = models.BooleanField()
Pengguna = models.ManyToManyField(User, through='Akses')
class Akses(models.Model):
User = models.ForeignKey(User,on_delete=models.CASCADE,to_field='UserID')
Item = models.ForeignKey(Item,on_delete=models.CASCADE,to_field='ItemID')
StatusAkses = models.BooleanField()

19
primary/static/style.css Normal file
View File

@ -0,0 +1,19 @@
body {
margin: 0 0 0 0;
}
.header {
height: 4rem;
width: 100%;
z-index: 10;
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
background-color: #3b90c6;
color: #ffffff;
}
.header-left {
margin-left: 1rem;
}

1
primary/static/tailwind.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,37 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Beri Akses</h1>
{% endblock %}
{% block content %}
<div>
<form action="/akses/add-post" method="POST">
<div>
<label for="User">User</label>
<select class="border py-1 px-2" name="User">
{% for entry in users %}
<option value={{ entry.UserID }}>{{ entry.NamaUser }}</option>
{% endfor %}
</select>
</div>
<div>
<label for="Item">Item</label>
<select class="border py-1 px-2" name="Item">
{% for entry in items %}
<option value={{ entry.ItemID }}>{{ entry.NamaItem }}</option>
{% endfor %}
</select>
</div>
<div>
<label for="StatusAkses">Status Akses</label>
<select class="border py-1 px-2" name="StatusAkses">
<option value="0">Dilarang</option>
<option value="1">Diperbolehkan</option>
</select>
</div>
{% csrf_token %}
<button type="submit" class="bg-blue-500 text-white py-2 px-4 text-center">Submit</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,22 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Daftar Akses</h1>
{% endblock %}
{% block content %}
<div>
{% for entry in aksess %}
<div class="px-4 py-4 flex flex-row justify-start aksess-center hover:bg-blue-300">
{{ entry.User.NamaUser }}
<br/>
{% if entry.StatusAkses %}
diperbolehkan mengakses
{% else %}
tidak diperbolehkan mengakses
{% endif %}
{{ entry.Item.NamaItem }}
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,36 @@
{% extends "layouts/base.html" %}
{% block content %}
<div class="flex flex-row flex-wrap">
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/user/add">Tambah User</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/user/">Daftar User</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/ruang/add">Tambah Ruang</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/ruang/">Daftar Ruang</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/item/add">Tambah Item</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/item/">Daftar Item</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/penghuni/add">Tambah Penghuni</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/penghuni/">Daftar Penghuni</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/akses/add">Beri Akses</a>
</div>
<div class="text-4xl bg-blue-300 h-64 flex flex-row justify-center items-center w-1/2">
<a class="inline w-full text-center align-middle" href="/akses/">Lihat Akses</a>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,30 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Tambah Item</h1>
{% endblock %}
{% block content %}
<div>
<form action="/item/add-post" method="POST">
<div>
<label for="NamaItem">Nama Item</label>
<input type="text" class="border py-1 px-2" name="NamaItem">
</div>
<div>
<label for="NamaItem">Status Item</label>
<input type="checkbox" class="border py-1 px-2" name="StatusItem">
</div>
<div>
<label for="Ruang">Ruang</label>
<select class="border py-1 px-2" name="Ruang">
{% for entry in ruangs %}
<option value={{ entry.RuangID }}>{{ entry.NamaRuang }}</option>
{% endfor %}
</select>
</div>
{% csrf_token %}
<button type="submit" class="bg-blue-500 text-white py-2 px-4 text-center">Submit</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Daftar Item</h1>
{% endblock %}
{% block content %}
<div>
{% for entry in items %}
<div class="px-4 py-4 flex flex-row justify-start items-center hover:bg-blue-300">
{{ entry.NamaItem }}
<br/>
di {{ entry.Ruang.NamaRuang }}, {{ entry.Ruang.Rumah.NamaRumah }}
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,24 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<link href="{% static "tailwind.min.css" %}" rel="stylesheet">
<title>MyHome</title>
</head>
<body>
<div class=" h-16 w-full z-10 flex flex-row justify-start items-center bg-blue-500 text-white">
<div class="ml-4">
<a href="/">{% block title %} MyHome {% endblock %}</a>
</div>
<div class="mr-4">
</div>
</div>
<div class="py-4 px-4 h-32 flex flex-row justify-start items-center bg-blue-500 text-white text-4xl">
{% block subtitle %} Selamat datang di rumah! {% endblock %}
</div>
<div class="my-4 mx-4">
{% block content %} {% endblock %}
</div>
</body>
</html>

View File

@ -0,0 +1,38 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Tambah Penghuni</h1>
{% endblock %}
{% block content %}
<div>
<form action="/penghuni/add-post" method="POST">
<div>
<label for="User">User</label>
<select class="border py-1 px-2" name="User">
{% for entry in users %}
<option value={{ entry.UserID }}>{{ entry.NamaUser }}</option>
{% endfor %}
</select>
</div>
<div>
<label for="Rumah">Rumah</label>
<select class="border py-1 px-2" name="Rumah">
{% for entry in rumahs %}
<option value={{ entry.RumahID }}>{{ entry.NamaRumah }}</option>
{% endfor %}
</select>
</div>
<div>
<label for="Role">Role</label>
<select class="border py-1 px-2" name="Role">
<option value="1">Penghuni</option>
<option value="2">Pemilik</option>
<option value="4">Pengontrak</option>
</select>
</div>
{% csrf_token %}
<button type="submit" class="bg-blue-500 text-white py-2 px-4 text-center">Submit</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Daftar Penghuni</h1>
{% endblock %}
{% block content %}
<div>
{% for entry in penghunis %}
<div class="px-4 py-4 flex flex-row justify-start penghunis-center hover:bg-blue-300">
{{ entry.User.NamaUser }}
<br/>
di {{ entry.Rumah.NamaRumah }} dengan role {{ entry.Role }}
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Tambah Ruang</h1>
{% endblock %}
{% block content %}
<div>
<form action="/ruang/add-post" method="POST">
<div>
<label for="NamaRuang">Nama Ruang</label>
<input type="text" class="border py-1 px-2" name="NamaRuang">
</div>
<div>
<label for="Rumah">Rumah</label>
<select class="border py-1 px-2" name="Rumah">
{% for entry in rumahs %}
<option value={{ entry.RumahID }}>{{ entry.NamaRumah }}</option>
{% endfor %}
</select>
</div>
{% csrf_token %}
<button type="submit" class="bg-blue-500 text-white py-2 px-4 text-center">Submit</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Daftar Ruang</h1>
{% endblock %}
{% block content %}
<div>
{% for entry in ruangs %}
<div class="px-4 py-4 flex flex-row justify-start items-center hover:bg-blue-300">
{{ entry.NamaRuang }}
<br/>
di {{ entry.Rumah.NamaRumah }}
</div>
{% endfor %}
</div>
{% endblock %}

View File

@ -0,0 +1,19 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Tambah Rumah</h1>
{% endblock %}
{% block content %}
<div>
<h1 class="text-4xl">Tambah Rumah</h1>
<form action="/rumah/add-post" method="POST">
<div>
<label for="NamaRumah">Nama Rumah</label>
<input type="text" class="border py-1 px-2" name="NamaRumah">
</div>
{% csrf_token %}
<button type="submit" class="bg-blue-500 text-white py-2 px-4 text-center">Submit</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,18 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Tambah User</h1>
{% endblock %}
{% block content %}
<div>
<form action="/user/add-post" method="POST">
<div>
<label for="NamaUser">Nama User</label>
<input type="text" class="border py-1 px-2" name="NamaUser">
</div>
{% csrf_token %}
<button type="submit" class="bg-blue-500 text-white py-2 px-4 text-center">Submit</button>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,15 @@
{% extends "layouts/base.html" %}
{% block subtitle %}
<h1 class="text-4xl">Daftar User</h1>
{% endblock %}
{% block content %}
<div>
{% for entry in users %}
<div class="px-4 py-4 flex flex-row justify-start items-center hover:bg-blue-300">
{{ entry.NamaUser }}
</div>
{% endfor %}
</div>
{% endblock %}

3
primary/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

26
primary/urls.py Normal file
View File

@ -0,0 +1,26 @@
from django.urls import path
from primary import views
urlpatterns = [
path('', views.index, name='index'),
path('rumah/add', views.rumah_add, name='rumah_add'),
path('rumah/add-post', views.rumah_add_post, name='rumah_add_post'),
path('user/', views.user_index, name='user_index'),
path('user/add', views.user_add, name='user_add'),
path('user/add-post', views.user_add_post, name='user_add_post'),
path('ruang/', views.ruang_index, name='ruang_index'),
path('ruang/add', views.ruang_add, name='ruang_add'),
path('ruang/add-post', views.ruang_add_post, name='ruang_add_post'),
path('item/', views.item_index, name='item_index'),
path('item/add', views.item_add, name='item_add'),
path('item/add-post', views.item_add_post, name='item_add_post'),
path('penghuni/', views.penghuni_index, name='penghuni_index'),
path('penghuni/add', views.penghuni_add, name='penghuni_add'),
path('penghuni/add-post', views.penghuni_add_post, name='penghuni_add_post'),
path('akses/', views.akses_index, name='akses_index'),
path('akses/add', views.akses_add, name='akses_add'),
path('akses/add-post', views.akses_add_post, name='akses_add_post'),
]

101
primary/views.py Normal file
View File

@ -0,0 +1,101 @@
from django.shortcuts import render, redirect
from primary.models import User, Rumah, Ruang, Item, DetailPenghuni, Akses
# Create your views here.
def post_without_csrf(post_data):
return {i:post_data[i] for i in post_data if i!='csrfmiddlewaretoken'}
def index(request):
try:
rumah = Rumah.objects.get()
return render(request, 'index.html', {})
except:
return redirect('/rumah/add')
def rumah_add(request):
return render(request, 'rumah/add.html', {})
def rumah_add_post(request):
rumah = Rumah(**post_without_csrf(request.POST))
rumah.save()
return redirect('/');
def user_add(request):
return render(request, 'user/add.html', {})
def user_add_post(request):
user = User(**post_without_csrf(request.POST))
user.save();
return redirect('/');
def user_index(request):
users = User.objects.all();
return render(request, 'user/index.html', {'users': users} )
def ruang_add(request):
rumahs = Rumah.objects.all();
return render(request, 'ruang/add.html', {'rumahs': rumahs})
def ruang_add_post(request):
params = post_without_csrf(request.POST)
params['Rumah'] = Rumah.objects.get(pk=params['Rumah'])
ruang = Ruang(**params)
ruang.save();
return redirect('/');
def ruang_index(request):
ruangs = Ruang.objects.all()
return render(request, 'ruang/index.html', {'ruangs': ruangs} )
def item_add(request):
ruangs = Ruang.objects.all();
return render(request, 'item/add.html', {'ruangs': ruangs})
def item_add_post(request):
params = post_without_csrf(request.POST)
params['Ruang'] = Ruang.objects.get(pk=params['Ruang'])
if 'StatusItem' in params:
params['StatusItem'] = 1
else:
params['StatusItem'] = 0
item = Item(**params)
item.save();
return redirect('/');
def item_index(request):
items = Item.objects.all()
return render(request, 'item/index.html', {'items': items} )
def penghuni_add(request):
users = User.objects.all();
rumahs = Rumah.objects.all();
return render(request, 'penghuni/add.html', {'users': users, 'rumahs': rumahs})
def penghuni_add_post(request):
params = post_without_csrf(request.POST)
params['Rumah'] = Rumah.objects.get(pk=params['Rumah'])
params['User'] = User.objects.get(pk=params['User'])
penghuni = DetailPenghuni(**params)
penghuni.save()
return redirect('/');
def penghuni_index(request):
penghunis = DetailPenghuni.objects.all()
return render(request, 'penghuni/index.html', {'penghunis': penghunis} )
def akses_add(request):
users = User.objects.all();
items = Item.objects.all();
return render(request, 'akses/add.html', {'users': users, 'items': items})
def akses_add_post(request):
params = post_without_csrf(request.POST)
params['Item'] = Item.objects.get(pk=params['Item'])
params['User'] = User.objects.get(pk=params['User'])
akses = Akses(**params)
akses.save()
return redirect('/');
def akses_index(request):
aksess = Akses.objects.all()
return render(request, 'akses/index.html', {'aksess': aksess} )

0
tugas/__init__.py Normal file
View File

16
tugas/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for tugas project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tugas.settings')
application = get_asgi_application()

121
tugas/settings.py Normal file
View File

@ -0,0 +1,121 @@
"""
Django settings for tugas project.
Generated by 'django-admin startproject' using Django 3.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
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/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '0ml1okc11kbdz93vt9sy(8vmb1)tjpap74gz6b!3ggz4fr%#u8'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'primary'
]
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',
]
ROOT_URLCONF = 'tugas.urls'
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 = 'tugas.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/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/3.0/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/3.0/howto/static-files/
STATIC_URL = '/static/'

22
tugas/urls.py Normal file
View File

@ -0,0 +1,22 @@
"""tugas URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('primary.urls')),
]

16
tugas/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for tugas project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tugas.settings')
application = get_wsgi_application()