Answer the question
In order to leave comments, you need to log in
Why doesn't it open links?
A question from the category of stupid, but incomprehensible for a beginner.
I made such a simple site on which there are several links, when you click on these links, a new page opens, the question is why when I open some link, for example "News" and then I want to open "Posts" or go back, it gives error. Why does it roughly say "127.0.0.1:8000/news.html/post.html" and not immediately "127.0.0.1:8000/post.html/" ?
urls.py
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('users.urls')),
url(r'^news.html/$', include('users.urls')),
url(r'^post.html/$', include('users.urls')),
]
from django.conf.urls import url, include
from . import views
urlpatterns = (
url(r'^$', views.index, name='index'),
url(r'^news.html/$', views.news, name='news'),
url(r'^post.html/$', views.post, name='post'),
)
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def hello(request):
return HttpResponse('asdasd')
def index(request):
return render(request, 'mainApp/index.html')
def news(request):
return render(request, 'mainApp/news.html')
def post(request):
return render(request, 'mainApp/post.html')
def result(request):
return render(request, 'mainApp/result.html')
def info(request):
return render(request, 'mainApp/info.html')
def contact(request):
return render(request, 'mainApp/contact.html')
def auth(request):
return render(request, 'mainApp/auth.html')
def reg(request):
return render(request, 'mainApp/reg.html')
Answer the question
In order to leave comments, you need to log in
Show markup. Wang that there are no slashes in the links.
And do not post the code in pictures, it is prohibited by the rules and generally indecent.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question