That is correct.
I believe you could go even further and not even prefix the app's urls, by
adding an empty path (r'^', include('api.urls')),
I don't quite remember what the raw string should look like, but this would
let you apply your app's url patterns to the root of your domain, which in
some cases is useful.
Cheers,
AT
On Fri, Oct 7, 2011 at 5:51 AM, Kayode Odeyemi <[email protected]> wrote:
> On Fri, Oct 7, 2011 at 9:33 AM, Daniel Roseman <[email protected]>wrote:
>
>> On Friday, 7 October 2011 09:20:03 UTC+1, Kayode Odeyemi wrote:
>>>
>>> 2011/10/6 Yaşar Arabacı <[email protected]>
>>>
>>> maybe you should restart the server? And, do you include new urls in your
>>>> root url config?
>>>>
>>>> OK! I just found out that if you have urls.py in different packages and
>>> these urls.py files are all included in the root package urls.py file of the
>>> app, if I have a url (say /post) defined within a python module in the
>>> package app.api, I will have to access the url like this
>>> http://example.com/api/post and not http://example/post. I was
>>> attempting the later which is the reason for the 404.
>>>
>>
>> No, that's not true. The name of the app has nothing to do with it.
>> Rather, it's the name you give when you include the app's URLs:
>>
>> (r'^randomname/', include('api.urls'))
>>
>> That will include the 'api' app's URLs with the prefix 'randomname', so
>> you would do example.com/randomname/post/.
>>
>
> If I understand you clearly, that means for all views in api/views.py which
> has its urls.py (which is within /api) included in the root package of the
> app like so: (r'^api/', include('api.urls')), will be accessed like this:
> http://example.com/api/[url-pattern]?
>
> --
> Odeyemi 'Kayode O.
> http://www.sinati.com. t: @charyorde
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.