November 2015
Beginner to intermediate
840 pages
26h 30m
English
Rather than simply displaying a webpage on our homepage, we will instead redirect the user to the desired URL. In this instance, http://site.django-unleashed.com/ will redirect to http://site.django-unleashed.com/blog/, which is the post_list() view.
To redirect a URL, we need a view. This creates a minor problem: we are redirecting our site-wide homepage with a view, which at this point exists only in app directories. However, this code does not belong in either our organizer or blog apps. Although Django does not anticipate the need for site-wide views.py, nothing is stopping us from creating /suorganizer/views.py. Inside, we write the code shown in Example 5.75.
Example 5.75: Project Code
Read now
Unlock full access