#28413: URL namespaces do not work if the django project is used as django app
-----------------------------------------+------------------------
               Reporter:  stephanm       |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  1.11
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 In https://docs.djangoproject.com/en/1.11/ref/applications/#projects-and-
 applications
 there is written:
 "There’s no restriction that a project package can’t also be considered an
 application and have models, etc. (which would require adding it to
 INSTALLED_APPS)"

 My environment:
  - django 1.11.3
  - python 3.6.2 64 bit
  - Windows 7 SP1 64bit Pro German

 This is just what I did:
  - I created a djproject with {{{django-admin startproject djproject}}}
  - then I added "djproject" to INSTALLED_APPS
  - now I added the following files:
    -  djproject/views.py
    -  djproject/Templates/djproject/index.html
  - in djproject/urls.py I add the module veriable:
    {{{app_name = "djproject"}}}

 my index.html looks like:
 {{{
 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="UTF-8">
 <title>Insert title here</title>
 </head>
 <body>
 <p> the title is {{title}}</p>
 <p> the url of this page is: {% url 'index' %}
 </body>
 </html>
    }}}

 which works!
 But if modify it to use namespace 'djproject' like this:
 {{{
 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="UTF-8">
 <title>Insert title here</title>
 </head>
 <body>
 <p> the title is {{title}}</p>
 <p> the url of this page is: {% url 'djproject:index' %}
 </body>
 </html>
 }}}

 I get an Exception:
    {{{django.urls.exceptions.NoReverseMatch: 'djproject' is not a
 registered namespace}}}

 The whole project is attached. To reproduce:
 - run: {{{manage.py runserver}}}
 - browse to: {{{http://localhost:8000}}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28413>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.cb05d3ab7954ec3062e6bb3eaaf977ea%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to