django 404找不到页面

时间:2019-02-27 21:14:04

标签: python django http-status-code-404

我正在尝试在网站上显示博客文章。

下面是listView = (ListView)findViewById(R.id.listItemAllGroupVaccinations); databaseReference = FirebaseDatabase.getInstance().getReference("groupVaccinations"); groupVaccinations = new ArrayList<>(); protected void onStart(){ super.onStart(); databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot groupVaccinationSnapshot : dataSnapshot.getChildren()){ GroupVaccination groupVaccination = groupVaccinationSnapshot.getValue(GroupVaccination.class); groupVaccinations.add(groupVaccination); } AllGroupVaccinationList groupVaccinationInfoAdapter = new AllGroupVaccinationList(ActivityAllGroupVaccinations.this, groupVaccinations); listView.setAdapter(groupVaccinationInfoAdapter); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } urls文件详细信息,但仍显示view

urls.py

404 not found page

views.py

from django.urls import path
from . import views

urlpatterns = [
    path("", views.index, name="ShopHome"),
    path("blogpost/", views.blogpost, name="blogpost")
]

显示:

  

404找不到页面

2 个答案:

答案 0 :(得分:0)

您应该将urls.py的应用程序包含到项目urls.py

实际上,如果您的项目名称为“ mysite”,而您的应用程序名称为“ blogspot”,则应在文件mysite/blogspot/urls.py上包含mysite/mysite/urls.py,如下所示:

from django.urls import path, include

urlpatterns = [
   path('', include('blogspot.urls')),
]

答案 1 :(得分:0)

实际上,我忘记在URL中注册该应用程序的URL时添加斜杠