Answer the question
In order to leave comments, you need to log in
Link to another page, how to make 2 links different pages?
Good afternoon!
There are 2 html pages and url links
from django.contrib import admin
from django.conf.urls import url, include
urlpatterns = [
url('admin/', admin.site.urls),
url(r'^$', include('mainapp.urls')),
url(r'^стейк-лосося/', include('mainapp.urls')),
]
from django.shortcuts import render
def index(request):
context = {"name":"Django", "version":2.0}
return render(request, 'mainapp/index.html', context)
def index_wrapper(request):
context = {"name":"Django", "version":2.0}
return render(request, 'mainapp/wrapper.html', context)
from django.conf.urls import url, include
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^mainapp/', views.index_wrapper, name='index_wrapper'),
]
Answer the question
In order to leave comments, you need to log in
Why do you include the same link file in two places (addresses)?
urlpatterns = [
url(r'^$', include('mainapp.urls')),
url(r'^стейк-лосося/', include('mainapp.urls')),
]
from django.conf.urls import url
from mainapp.views import index, index_wrapper
urlpatterns = [
url(r'^$', index, name='index'),
url(r'^стейк-лосося/', index_wrapper, name='index_wrapper'),
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question