On 9/9/13 5:40 PM, Chris Kavanagh wrote:
This is just a tutorial I'm going through Tom. I'm not trying to write anything, just trying to understand this part. And I apologize for making my question(s) confusing, I'm not exactly sure how to ask it.

Let's back up for a second. I'm not trying to match anything, I was telling you what I already had in my files (from the tutorial). What I do not understand is why the "/articles/" part of the url needs be included when I want to go to my "/create/" view? In other words, why does the url need to be "http://127.0.0.1:8000/articles/create"; INSTEAD OF "http://127.0.0.1:8000/create"; ? Am I making sense, lol?

I have "url(r'^create/$', 'article.views.create')" in my urlconf, so why must I include "/article/" when I want to go to "http://127.0.0.1:8000/create";? You said "All of your "urlconf" paths will need to have "/articles" in the path to be found". Why? That is my question? I'm obviously not understanding something that I should already know. I get that I also have "(r'^articles/', include('article.urls'))" in my main urlconf. I thought this line of code just linked up the other urlconf in my app package and that's all it did.
Well, no it is not "just linked up". Since you put a pattern "^/articles/$" to be matched in the primary urls.py file, and since the next argument is "include('article.urls')", that secondary "article.urls" will never be seen to be matched unless you get a match on the leading "/articles/". Go back to my previous response and look at the three steps in matching a nested URL.

hth

                             - Tom



I hope I made my question a little clearer, lol. I'm not sure how to ask what I want to know. But again, THANKS for the help Tom!



On Mon, Sep 9, 2013 at 7:48 PM, Thomas Lockhart <tlockhart1...@gmail.com <mailto:tlockhart1...@gmail.com>> wrote:


        Tom, thanks so much for the reply. . .Yes, that was a typo,
        it should've been "/articles" not "/article".

     I know this is going to be a stupid question, but why do my
    "urlconf" paths need to have "/articles"
    in it as you said?
    There are three steps in the interpretation of the pattern.
    1) If the pattern starts with "/articles", try matching within
    your "urlconf" file.
    2) If the remaining portion of the url matches a pattern in the
    "urlconf" file, stop there.
    3) If the remaining portion does not match in the "urlconf" file,
    keep looking farther down your main url file.

    If you don't want the /articles prefix in your paths, write your
    patterns more explicitly at the top level.

    It *is* pretty typical to have separate apps have distinct
    prefixes in their URL paths.

    hth

                                  - Tom
-- You received this message because you are subscribed to a topic in
    the Google Groups "Django users" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/django-users/43W4LSOuUUw/unsubscribe.
    To unsubscribe from this group and all its topics, send an email
    to django-users+unsubscr...@googlegroups.com
    <mailto:django-users%2bunsubscr...@googlegroups.com>.
    To post to this group, send email to django-users@googlegroups.com
    <mailto:django-users@googlegroups.com>.
    Visit this group at http://groups.google.com/group/django-users.
    For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to