Fakultas Ilmu Komputer UI

Commit 99944dd1 authored by Samuel Dimas's avatar Samuel Dimas
Browse files

[CHORES] Initial push

parent fa1b3929
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class AppConfig(AppConfig):
name = 'app'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.urls import path, re_path
from app import views
urlpatterns = [
# Matches any html file
re_path(r'^.*\.html', views.pages, name='pages'),
]
\ No newline at end of file
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect
def pages(request):
context = {}
# All resource paths end in .html.
# Pick out the html file name from the url. And load that template.
try:
load_template = request.path.split('/')[-1]
template = loader.get_template(load_template)
return HttpResponse(template.render(context, request))
except:
template = loader.get_template('error-404.html')
return HttpResponse(template.render(context, request))
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