2015-02-23 15:30 GMT+01:00 Brad Rice <bradri...@gmail.com>:

> I'm using RedirectView and it is redirecting to my app, but is not
> rendering the view in the app I am pointing to.
>
> I want to redirect my root / to my app /web
>
> I have this in my primary app urls:
>
> url(r'^$', RedirectView.as_view(url='/web/', permanent=False)),
>
> I have this in web.urls.py
>
> url(r'^$', IndexView.as_view(), name='index'),
>
> I have his in my web.vews.py
>
> class Index(View):
>
> def get(self, request, *args, **kwargs):
> return HttpResponse('Hello, World!')
>
> when I go to / I do get redirected to /web/ but I get a index.html
> template display rather than Hello World. It isn't finding my Index(View)
> class for some reason.
>
> Can anybody explain to me how this should work?
>
> --
> Brad Rice
> bradri...@gmail.com
> --
> To succeed in life, you need two things: ignorance and confidence.
> -Mark Twain
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMqTKp4vQmDez7tJSZ54j96huCfhTiCY3F2-g_Lpgq-8sgPMEw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAMqTKp4vQmDez7tJSZ54j96huCfhTiCY3F2-g_Lpgq-8sgPMEw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

Hi Brad,

You have not correctly written the web.urls.py file. It should be:

url(r'^web/$', IndexView.as_view(), name='index'),

The urls file doesn't know about in which app it resides, så you have to
add the complete url yourself. As long as you don't add the web.urls.py
into your main urls.py file with:

url(r'^web/', include(web.urls)),

then your code should work ok.

Regards,

Andréas

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUb%3DHePP0DAm2Bodmaxt8sSYqo7A2hiNwvtLPRXV7Aarrdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to