On Fri, Oct 7, 2011 at 9:33 AM, Daniel Roseman <dan...@roseman.org.uk>wrote:

> On Friday, 7 October 2011 09:20:03 UTC+1, Kayode Odeyemi wrote:
>>
>> 2011/10/6 Yaşar Arabacı <yasar...@gmail.com>
>>
>> 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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to