Url config. Map / to home_page view
This commit is contained in:
parent
285725ffdd
commit
1e2cc408de
@ -5,9 +5,7 @@ from lists.views import home_page
|
|||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
class HomePageTest(TestCase):
|
class HomePageTest(TestCase):
|
||||||
def test_home_page_returns_correct_html(self):
|
def test_home_page_returns_correct_html(self):
|
||||||
request = HttpRequest()
|
response = self.client.get("/")
|
||||||
response = home_page(request)
|
self.assertContains(response, "<title>To-Do lists</title>")
|
||||||
html = response.content.decode("utf8")
|
self.assertContains(response, "<html>")
|
||||||
self.assertIn("<title>To-Do lists</title>", html)
|
self.assertContains(response, "</html>")
|
||||||
self.assertTrue(html.startswith("<html>"))
|
|
||||||
self.assertTrue(html.endswith("</html>"))
|
|
@ -14,9 +14,9 @@ Including another URLconf
|
|||||||
1. Import the include() function: from django.urls import include, path
|
1. Import the include() function: from django.urls import include, path
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from lists.views import home_page
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path("", home_page, name="home"),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user