Я пытаюсь отобразить этот HTML файл (домашняя страница), и я получаю сообщение об ошибке, что шаблон не найден.
#views.py
from django.shortcuts import render
def index(request):
"""Homepage"""
return render(request,'templates/index.html')
from django.contrib import admin
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.index, name='Home'),
]
Ошибка:
TemplateDoesNotExist at /
templates/index.html
и просто загружается пустая страница:
from django.shortcuts import render
def index(request):
"""Homepage"""
return render(request, 'index.html')
Мой HTML Файл
Я предполагаю, что здесь может отсутствовать какая-то ссылка. Я также добавил «os.path.join (BASE_DIR,« templates »)» к DIRS и настройке, и страница все еще пуста.
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<a href="{% url 'index' %}">Home</a>.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>Triangulation Calculator</title>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Three Positions Triangulation</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Second </a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Add Known Location</a>
</li>
</ul>
</div>
</div>
</nav>
<section class="py-5 text-center">
<div class="container">
<h2 class="text-center">Triangulation Calculator</h2>
<p class="text-muted mb-5 text-center">There's three Features here, below, you'll find explaintion for each.</p>
<div class="row">
<div class="col-sm-6 col-lg-4 mb-3">
<svg class="lnr text-primary services-icon">
<use xlink:href="#lnr-magic-wand"></use>
</svg>
<h6>Three Positions Triangulation</h6>
<p class="text-muted">Naming is All, Choose a grate name for your mission so you can come back and open that map whenever you want.
You input the latitude and longitude for GDT 1, GDT 2 and the location of the UAV, also, we need the
elevation of the uav above sea level, where do you get that data?
Thank God for Google.
go to google maps, when you press a location on the map you can the coordinates as we need them, in the following format:
31.4531,35.56243.
first is latitude and longitude, copy the values to calculator.
done?
press POST
the page will refresh and you'll see all your data.
go to the address line and add the mission name to the and of the line.
KABLAM!
Your map will open.</p>
</div>
<div class="col-sm-6 col-lg-4 mb-3">
<svg class="lnr text-primary services-icon">
<use xlink:href="#lnr-heart"></use>
</svg>
<h6>Second GDT options</h6>
<p class="text-muted">Second option works a lot the same: Input your mission name and the data for GDT 1 and the UAV, and choose the area of the mission.
and the rest is the same.
How does the map work here?
if you hover your mouse over one of the numbers you'll see the boundaries of that triangulation, the more you zoom in,
the more detailed it gets.</p>
</div>
<div class="col-sm-6 col-lg-4 mb-3">
<svg class="lnr text-primary services-icon">
<use xlink:href="#lnr-rocket"></use>
</svg>
<h6>Add Location Info to the DataBase</h6>
<p class="text-muted">Here you input a base,outpost,mountain or just every location you ever put a GDT in.
choose the area where that position lies.
and every time someone will use the second option, we'll automatically add those positions to the map.</p>
</div>
</div>
</div>
</div>
</section>
</body>
</html>