摘要:修改添加上面的規(guī)則首頁(yè)欄目文章詳情啟動(dòng)服務(wù)器解決方案見(jiàn)將寫(xiě)成解決方案可以替換為你新建的應(yīng)用名稱是在你創(chuàng)建的應(yīng)用下的寫(xiě)法改為參考的寫(xiě)法
"""minicms URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r"^$", views.home, name="home") Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r"^$", Home.as_view(), name="home") Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r"^blog/", include("blog.urls")) """ from django.conf.urls import url from django.contrib import admin # from django.conf import settings # from django.conf.urls import include, url from DjangoUeditor import urls as DjangoUeditor_urls from news.views import index from news.views import column_detail from news.views import article_detail urlpatterns = [ # 修改 minicms/urls.py 添加上面的規(guī)則: # 首頁(yè) index 欄目 column 文章詳情 article #url(r"^blog/", include("blog.urls")) url(r"^$", index), #url(r"^column/(?P[^/]+)/$", "news.views.column_detail", name="column"), #url(r"^news/(?P [^/]+)/$", "news.views.article_detail", name="article"), # #url(r"^ueditor/", include("DjangoUeditor.urls" )), #url(r"^admin/", admin.site.urls), #url(r"^$", "news.views.index", name="index"), url(r"^column/(?P [^/]+)/$", column_detail), url(r"^news/(?P [^/]+)/$", article_detail), url(r"^admin/", include(admin.site.urls)), ] if settings.DEBUG: from django.conf.urls.static import static urlpatterns += static( settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 啟動(dòng)服務(wù)器:python manage.py runserver System check identified no issues (0 silenced). July 24, 2017 - 20:50:33 Django version 1.11.3, using settings "minicms.settings" Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK.
解決方案1:
見(jiàn)https://stackoverflow.com/que...
將url(r"^website/$","website.views.first_page"),寫(xiě)成url(r"^website/$", website.views.first_page),
解決方案2:
from news import views
url(r"^$", index), #url(r"^column/(?P[^/]+)/$", news.views.column_detail", name="column"), #url(r"^news/(?P [^/]+)/$", news.views.article_detail", name="article"),
寫(xiě)法改為:
url(r"^$", views.index, name="index"), url(r"^column/(?P[^/]+)/$", views.column_detail, name="column"), url(r"^news/(?P [^/]+)/$", views.article_detail, name="article"),
【參考】http://blog.csdn.net/godlikeb...
的寫(xiě)法
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/40649.html
摘要:如果使用的是前綴,多余的參數(shù)則會(huì)被認(rèn)為是一個(gè)字典的鍵值對(duì)。表達(dá)式語(yǔ)句被用來(lái)創(chuàng)建新的函數(shù)對(duì)象,并且在運(yùn)行時(shí)返回它們。函數(shù)函數(shù)用來(lái)取得對(duì)象的規(guī)范字符串表示。反引號(hào)也稱轉(zhuǎn)換符可以完成相同的功能?;旧?,函數(shù)和反引號(hào)用來(lái)獲取對(duì)象的可打印的表示形式。 Content List 1.Datastruct 1.1 List 1.2 Tuple 1.3 Dict 1.4 Seq 2.I/O...
摘要:流暢的中有很多奇技淫巧,整本書(shū)都在強(qiáng)調(diào)如何最大限度地利用標(biāo)準(zhǔn)庫(kù)。常見(jiàn)的扁平序列包括,,等。數(shù)組支持所有跟可變序列有關(guān)的操作,包括和。和用于指定列表的區(qū)間,默認(rèn)是使用整個(gè)列表。但是元組的賦值不被允許,當(dāng)異發(fā)生時(shí) 流暢的python中有很多奇技淫巧,整本書(shū)都在強(qiáng)調(diào)如何最大限度地利用Python 標(biāo)準(zhǔn)庫(kù)。介紹了很多python的不常用的數(shù)據(jù)類(lèi)型、操作、庫(kù)等,對(duì)于入門(mén)python后想要提升對(duì)p...
摘要:字典是內(nèi)置的數(shù)據(jù)結(jié)構(gòu),在寫(xiě)程序時(shí)會(huì)經(jīng)常用到。這里介紹一下它的方法和方法。在獲取中的數(shù)據(jù)時(shí),我們一般使用的方式,但是如果不存在的時(shí)候會(huì)拋出。 Python 之禪 The Zen of Python, by Tim Peters Beautiful is better than ugly. 優(yōu)美勝于丑陋(Python以編寫(xiě)優(yōu)美的代碼為目標(biāo)) Explicit is be...
摘要:聲明一個(gè)很簡(jiǎn)單,只需盡量不要將變量名起為關(guān)鍵字。有如下基本方法在的末尾添加一個(gè)元素,并且返回將另一個(gè)的對(duì)象添加到尾部,返回值為。返回值為刪掉的元素。為一個(gè)表達(dá)式,傳入當(dāng)前元素,返回時(shí)依據(jù)德關(guān)鍵字。 1.list 聲明一個(gè)list很簡(jiǎn)單,只需list1=[](盡量不要將變量名起為關(guān)鍵字list)。list有如下基本方法: (1)append(x) 在list的末尾添加一個(gè)元素x,并且返回...
摘要:原生的也可以從頭部添加和取出對(duì)象就像這樣但是值得注意的是,對(duì)象的這兩種用法的時(shí)間復(fù)雜度是,也就是說(shuō)隨著元素?cái)?shù)量的增加耗時(shí)呈線性上升。 基本介紹 Python擁有一些內(nèi)置的數(shù)據(jù)類(lèi)型,比如str, int, list, tuple, dict等, collections模塊在這些內(nèi)置數(shù)據(jù)類(lèi)型的基礎(chǔ)上,提供了幾個(gè)額外的數(shù)據(jù)類(lèi)型: namedtuple(): 生成可以使用名字來(lái)訪問(wèn)元素內(nèi)容的...
閱讀 2832·2021-11-22 15:11
閱讀 3555·2021-09-28 09:43
閱讀 2898·2019-08-30 13:05
閱讀 3442·2019-08-30 11:18
閱讀 1455·2019-08-29 16:34
閱讀 1313·2019-08-29 13:53
閱讀 2919·2019-08-29 11:03
閱讀 1669·2019-08-29 10:57