handle custom error templates
This commit is contained in:
@@ -20,4 +20,3 @@ class Letting(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ def index(request):
|
||||
context = {'lettings_list': lettings_list}
|
||||
return render(request, 'lettings/index.html', context)
|
||||
|
||||
|
||||
def letting(request, letting_id):
|
||||
letting = Letting.objects.get(id=letting_id)
|
||||
context = {
|
||||
|
||||
Binary file not shown.
@@ -3,6 +3,6 @@ import os
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
|
||||
'oc_lettings_site.settings')
|
||||
'oc_lettings_site.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
|
||||
@@ -13,9 +13,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = 'fp$9^593hsriajg$_%=5trot9g!1qa@ew(o-1#@=&4%=hp46(s'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
||||
|
||||
# Application definition
|
||||
@@ -117,4 +117,4 @@ USE_TZ = True
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATICFILES_DIRS = [BASE_DIR / "static",]
|
||||
STATICFILES_DIRS = [BASE_DIR / "static"]
|
||||
|
||||
@@ -8,4 +8,3 @@ class Profile(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ def index(request):
|
||||
context = {'profiles_list': profiles_list}
|
||||
return render(request, 'profiles/index.html', context)
|
||||
|
||||
|
||||
def profile(request, username):
|
||||
profile = Profile.objects.get(user__username=username)
|
||||
context = {'profile': profile}
|
||||
|
||||
25
templates/404.html
Normal file
25
templates/404.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}404 Not Found{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="container px-5 py-5 text-center">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-8">
|
||||
<h1 class="page-header-ui-title mb-3 display-6">Error - 404</h1>
|
||||
<h2 class="page-header-ui-title mb-3 display-6">Page Not Found</h2>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container px-5 py-5 text-center">
|
||||
<div class="justify-content-center">
|
||||
<p>An error has occurred</p>
|
||||
<a class="btn fw-500 ms-lg-4 btn-primary px-10" href="{% url 'index' %}">
|
||||
Back Home
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
24
templates/500.html
Normal file
24
templates/500.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}404 Not Found{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="container px-5 py-5 text-center">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-8">
|
||||
<h1 class="page-header-ui-title mb-3 display-6">Error - 500</h1>
|
||||
<h2 class="page-header-ui-title mb-3 display-6">Server Issue</h2>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container px-5 py-5 text-center">
|
||||
<div class="justify-content-center">
|
||||
<a class="btn fw-500 ms-lg-4 btn-primary px-10" href="{% url 'index' %}">
|
||||
Back Home
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user