先說(shuō)下配置:
https
nginx
django2.0
https://127.0.0.1正常加載,靜態(tài)文件也能加載沮脖。? 但我想增加url時(shí)卻出現(xiàn)了問(wèn)題金矛,無(wú)法找到網(wǎng)頁(yè)芯急,以下是我的代碼,希望大神幫我分析一下:
工程目錄下的url.py:
from django.urls import include,?
pathfrom django.contrib import admin
urlpatterns = [? ? path('', include('shiyan_app.urls')),??
? path('admin/', admin.site.urls),]
app目錄下的url.py:
from django.contrib import admin
from django.urls import pathfrom . import views
app_name = 'shiyan_app'
urlpatterns = [? ? path('',views.index, name='index'), ?
?path('qq/',views.index2,name='index2'),]
from django.shortcuts import render
from django.http import HttpResponse
def index(request):? ?
?return render(request,"index.html")
def index2(request):? ?
?return HttpResponse("Hello, world. You're at the polls index.")
想要實(shí)現(xiàn)的效果就是驶俊,127.0.0.1訪問(wèn)index函數(shù)(可以實(shí)現(xiàn))娶耍,127.0.0.1/qq訪問(wèn)index2函數(shù)(無(wú)法實(shí)現(xiàn))。
其中如果把127.0.0.1改成訪問(wèn)index2函數(shù)是可以正常顯示的饼酿,說(shuō)明函數(shù)本身是沒(méi)有問(wèn)題的榕酒。而其中我也無(wú)數(shù)次的重啟Uwsgi與Nginx,結(jié)果都是無(wú)法顯示/qq
請(qǐng)問(wèn)大神們故俐,究竟是哪里出錯(cuò)了想鹰,才導(dǎo)致我的urls.py按照官方及所有網(wǎng)上教程的規(guī)法設(shè)置全部失效................