Django管理员将我链接到模板

时间:2018-01-12 17:40:10

标签: python django web django-templates django-admin

在我的开发服务器上进行本地编程时,该站点正在按预期运行。但是当我访问我的生产网站时,mysite.com/admin中的一些链接将我链接到一个随机模板,该模板扩展了我的base.html,而不是典型的数据库/表单UI。

这里是mysite.urls.py:

urlpatterns = [
    path('admin/', admin.site.urls),
    path('account/login/', views.login, name='login'),
    path('account/logout/', views.logout, name='logout', kwargs={'next_page': '/'}),
    path('', include('website.urls')),
]

我的网站.urls.py:

urlpatterns = [
    path('', views.home_page, name='home_page'),
    path('community/', views.growing_communities_page, name='growing_communities_page'),
    path('recommend_a_friend/', views.signup, name='recommend_a_friend'),
    path('about/', views.about_page, name='about'),
    path('donate_to_feed/', views.donate_to_feed, name='donate_to_feed'),
    path('sign_up/', views.sign_up, name='sign_up'),
    path('profit_sharing/', views.profit_sharing, name='profit_sharing'),
    path('we_identify/', views.we_identify, name='we_identify'),
    path('account/', views.account, name='account'),
    path('community_page/<slug>/', views.community_page, name='community_page'),

    path('farm/<slug>/', views.farm_page, name='farm_page'),
    path('farm/<slug>/review/', views.add_comment_to_farm, name='add_comment_to_farm'),

    path('farmersmarket/<slug>/', views.farmersmarket_page, name='farmersmarket_page'),
    path('farmersmarket/<slug>/review/', views.add_comment_to_farmersmarket, name='add_comment_to_farmersmarket'),

    path('grocer/<slug>/', views.grocer_page, name='grocer_page'),
    path('grocer/<slug>/review/', views.add_comment_to_grocer, name='add_comment_to_grocer'),

    path('producer/<slug>/', views.producer_page, name='producer_page'),
    path('producer/<slug>/review/', views.add_comment_to_producer, name='add_comment_to_producer'),

    path('restaurant/<slug>/', views.restaurant_page, name='restaurant_page'),
    path('restaurant/<slug>/review/', views.add_comment_to_restaurant, name='add_comment_to_restaurant'),

    path('wellness/<slug>/', views.wellness_page, name='wellness_page'),
    path('wellness/<slug>/review/', views.add_comment_to_wellness, name='add_comment_to_wellness'),
]

和website.admin.py     admin.site.register(社区)

admin.site.register(Farm)
admin.site.register(FarmReview)
admin.site.register(Livestock)

admin.site.register(Farmersmarket)
admin.site.register(FarmersmarketReview)

admin.site.register(Grocer)
admin.site.register(GrocerReview)

admin.site.register(Producer)
admin.site.register(ProducerReview)

admin.site.register(Restaurant)
admin.site.register(RestaurantReview)

admin.site.register(Wellness)
admin.site.register(WellnessReview)

admin.site.register(MenuItem)
admin.site.register(MenuCategory)

admin.site.register(GrocerMenuItem)
admin.site.register(GrocerMenuCategory)

admin.site.register(Monday)
admin.site.register(Tuesday)
admin.site.register(Wednesday)
admin.site.register(Thursday)
admin.site.register(Friday)
admin.site.register(Saturday)
admin.site.register(Sunday)

admin.site.register(Address)

admin.site.register(ValueAddedProducts)
admin.site.register(Business)
admin.site.register(ProductsAvaiableAt)

admin.site.register(Map)
admin.site.register(Calendar)
admin.site.register(Communityspirit)
admin.site.register(Certifying_Organizations)

admin.site.register(About)

例如,我希望点击此菜单中的内容: enter image description here

会将我链接到此页面:  enter image description here

但相反,我得到了:  enter image description here

任何帮助都会很棒。

0 个答案:

没有答案