摘要:修改添加上面的規則首頁欄目文章詳情啟動服務器解決方案見將寫成解決方案可以替換為你新建的應用名稱是在你創建的應用下的寫法改為參考的寫法
"""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 添加上面的規則: # 首頁 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) 啟動服務器: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:
見https://stackoverflow.com/que...
將url(r"^website/$","website.views.first_page"),寫成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"),
寫法改為:
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...
的寫法
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/40649.html
摘要:如果使用的是前綴,多余的參數則會被認為是一個字典的鍵值對。表達式語句被用來創建新的函數對象,并且在運行時返回它們。函數函數用來取得對象的規范字符串表示。反引號也稱轉換符可以完成相同的功能。基本上,函數和反引號用來獲取對象的可打印的表示形式。 Content List 1.Datastruct 1.1 List 1.2 Tuple 1.3 Dict 1.4 Seq 2.I/O...
摘要:字典是內置的數據結構,在寫程序時會經常用到。這里介紹一下它的方法和方法。在獲取中的數據時,我們一般使用的方式,但是如果不存在的時候會拋出。 Python 之禪 The Zen of Python, by Tim Peters Beautiful is better than ugly. 優美勝于丑陋(Python以編寫優美的代碼為目標) Explicit is be...
摘要:聲明一個很簡單,只需盡量不要將變量名起為關鍵字。有如下基本方法在的末尾添加一個元素,并且返回將另一個的對象添加到尾部,返回值為。返回值為刪掉的元素。為一個表達式,傳入當前元素,返回時依據德關鍵字。 1.list 聲明一個list很簡單,只需list1=[](盡量不要將變量名起為關鍵字list)。list有如下基本方法: (1)append(x) 在list的末尾添加一個元素x,并且返回...
摘要:原生的也可以從頭部添加和取出對象就像這樣但是值得注意的是,對象的這兩種用法的時間復雜度是,也就是說隨著元素數量的增加耗時呈線性上升。 基本介紹 Python擁有一些內置的數據類型,比如str, int, list, tuple, dict等, collections模塊在這些內置數據類型的基礎上,提供了幾個額外的數據類型: namedtuple(): 生成可以使用名字來訪問元素內容的...
閱讀 2829·2021-11-22 15:11
閱讀 3547·2021-09-28 09:43
閱讀 2895·2019-08-30 13:05
閱讀 3436·2019-08-30 11:18
閱讀 1453·2019-08-29 16:34
閱讀 1308·2019-08-29 13:53
閱讀 2914·2019-08-29 11:03
閱讀 1666·2019-08-29 10:57