Specifying a namespace in include() without providing an app_name
原始碼:
根路徑檔案:
urlpatterns = [ path('admin/', admin.site.urls), url(r'myblog/', include('blog.urls', namespace='blog')) ]
子路徑檔案:
urlpatterns = [ url(r'blog/$', views.blog), url(r'article/(?P<article_id>[0-9]+)$', views.article_page, name='article_page') ]
根據錯誤提醒,在include方法裡面沒有提供APP名稱
一下提供兩種解決方法:
(1)在根路徑下的include()加入APP名稱,我這裡是blog
(2)在子路徑下加入
app_name = 'blog'(加入這句)
urlpatterns = [
url(r'blog/$', views.blog), url(r'article/(?P<article_id>[0-9]+)$', views.article_page, name='article_page')
]
相關推薦
Specifying a namespace in include() without providing an app_name is not supported.
報錯資訊: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or p
解決:Specifying a namespace in include() without providing an app_name和XXX is not a registered namespace問題
info clu .py 添加 圖片 alt support 遇到 without python3 Django 環境下,如果你遇到namespace沒有註冊以及在根目錄下urls.py中的include方法的第二個參數namespace添加之後就出錯的問題。 出錯問題:
關於Django Specifying a namespace in include() without providing an app_name
執行環境 PyCharm 2017.1 Django 2.0.1 python 3.6.1 在網頁專案中使用include()方法 專案目錄中同時存在app/urls.py和proj/urls.py 在proj/urls.py使用include方法 fro
Specifying a namespace in include() without providing an app_name
原始碼: 根路徑檔案: urlpatterns = [ path('admin/', admin.site.urls), url(r'myblog/', include('blog.urls', namespace='blog')) ] 子路徑檔案:
Zhong__django中Specifying a namespace in include() without providing an app_name問題
在Django專案中定義namespace時出現Specifying a namespace in include() without providing an app_name的報錯資訊 需要定義一個app_name的宣告資訊 即可解決此問題: app_name =
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using e
不得不說在leetcode上面刷題真的收穫很大,一些在學校老師根本不會教給你的知識點在這裡可以學到。 然後這題其實自己只是想到遍歷元素然後就是判斷是不是又重新遍歷到頭節點而已,但效率太低。無奈找了提示,看了別人的程式碼就心領神會了。 p
Cannot refer to a non-final variable xx inside an inner class defined in a different method的原因
今天遇到一個小問題,下面是網上摘抄的解釋: 為了說明這個問題,先得明白說明是區域性內部類,區域性內部類就是在外部類的方法中定義的類。那麼標題中的錯誤指的是,內部類不能引用該方法中非 final 修飾的變數。 那麼為什麼呢? 因為生命週期的原因。方法中的區域性變數,方法結
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using e
不得不說在leetcode上面刷題真的收穫很大,一些在學校老師根本不會教給你的知識點在這裡可以學到。 然後這題其實自己只是想到遍歷元素然後就是判斷是不是又重新遍歷到頭節點而已,但效率太低。無奈找了提示,看了別人的程式碼就心領神會了。 public clas
nginx啟動失敗(bind() to 0.0.0.0:80 failed,An attempt was made to access a socket in ...)
nginx 不能啟動,報錯如下 該錯誤 實在 nginx 的 logs 下的 errorr.log 中檢視 2018/12/24 10:29:15 [emerg] 14940#3232: bind() to 0.0.0.0:80 failed (10013: An attempt w
How to Check if an Array Contains a Value in Java Efficiently?
evel equal following ren ood fir -s nano -a How to check if an array (unsorted) contains a certain value? This is a very useful and freq
Solving Algorithmic Problems: Find a Duplicate in an Array
ProblemFind a duplicate in an arrayGiven an array of n + 1 integers between 1 and n, find one of the duplicates.If there are multiple possible answers, ret
Integrate a Model in an API Gateway
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "User", "type": "object", "properties": { "UserID": {
Nginx啟動報錯:10013: An attempt was made to access a socket in a way forbidden
Nginx在win7,win2008下啟動報錯:bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permi
Render a controller in Twig - Unexpected “render” tag - expecting closing tag for the “block” tag defined
lin ack defined for ont per -i undle control Render a controller in Twig - Unexpected “render” tag - expecting closing tag for the “block
NiceFish的ERROR in AppModule is not an NgModule問題
type png angular 項目 問題 cnp 版本 pmo all 大漠老師的angular2新手教程項目,nicefish剛開始下下來運行ng serve --prod --aot 是 出現ERROR in AppModule is not an NgModule
malloc: *** error for object 0x6080000bd200: Invalid pointer dequeued from free list *** set a breakpoint in malloc_error_break to debug
版本 解決 pointer 系統 解決方法 all list object ued 在集成第三方sdk的時候碰到這個問題, malloc: *** error for object 0x6080000bd200: Invalid pointer dequeued from
ORA-23421: job number 225 is not a job in the job queue
conn uil bms delet ext roc erro declare dba_jobs 在對數據庫進行異機恢復之後,為了防止上面作業自動執行,擾亂正常業務系統,需要將測試庫上的作業和db_link進行刪除:但是使用sys用戶連接進去,刪除的時候報如下錯誤SQL
09 Finding a Motif in DNA
pair enc res over dna pen frame ati range Problem Given two strings ss and tt, tt is a substring of ss if tt is contained as a contiguou
A simple in-process HTTP server for UWP
orm sage not div exc note isolation server cep 原文 http://www.dzhang.com/blog/2012/09/18/a-simple-in-process-http-server-for-windows-8-met
PAT1058:A+B in Hogwarts
name key col bst while size title plain 處理 1058. A+B in Hogwarts (20) 時間限制 50 ms 內存限制 65536 kB 代碼長度限制 16000 B 判題程序 Standard 作者 C