T
T
tyilamg2019-04-24 15:54:25
Django
tyilamg, 2019-04-24 15:54:25

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')),
]

urls.py application
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'),
)

views.py
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')

5cc05c5daa2f6475020246.png5cc05c6329905882390464.png5cc05c7434757451125745.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2019-04-24
@tyilamg

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 question

Ask a Question

731 491 924 answers to any question