{"id":4,"date":"2014-01-02T11:52:29","date_gmt":"2014-01-02T11:52:29","guid":{"rendered":"http:\/\/www.nedlowe.co.uk\/blog\/?p=4"},"modified":"2014-01-02T13:01:33","modified_gmt":"2014-01-02T13:01:33","slug":"django-homepage-with-multiple-apps","status":"publish","type":"post","link":"https:\/\/www.nedlowe.co.uk\/blog\/?p=4","title":{"rendered":"Django Homepage With Multiple Apps"},"content":{"rendered":"<p>After completing the Django tutorial, I was a little confused as to how one is supposed to structure the homepage for a web application containing multiple applications.<\/p>\n<p>There seem to be three common approaches:<\/p>\n<ul>\n<li>Flatpages &#8211; https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/flatpages\/<\/li>\n<li>Create a separate dedicated app<\/li>\n<li>Create a new views.py in the &#8220;project&#8221; folder which contains your settings.py<\/li>\n<\/ul>\n<p>Flatpages are static content pages which are saved in the database backing your Django application. \u00a0This makes creating a homepage very easy, but also &#8211; by definition &#8211; static. \u00a0This is probably most useful for things like an &#8220;About Us&#8221; page. \u00a0A homepage will surely have dynamic content (e.g. latest news).<\/p>\n<p>I opted to create a views.py in my project folder for now. \u00a0If this doesn&#8217;t work, I will look at creating a &#8220;general&#8221; application that fills the gaps between the specific dedicated apps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After completing the Django tutorial, I was a little confused as to how one is supposed to structure the homepage for a web application containing multiple applications. There seem to be three common approaches: Flatpages &#8211; https:\/\/docs.djangoproject.com\/en\/dev\/ref\/contrib\/flatpages\/ Create a separate dedicated app Create a new views.py in the &#8220;project&#8221; folder which contains your settings.py Flatpages [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7QqxF-4","jetpack-related-posts":[{"id":31,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=31","url_meta":{"origin":4,"position":0},"title":"SiteMesh with Spring MVC","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). SiteMesh is an open source framework that implements the Decorator pattern. It essentially takes the output stream from a web application, and adds elements to (\u2019decorates\u2019) it. Why would we want that? Put simply, it is an incredibly clean way of adding headers\/footers\/anything, with the\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":39,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=39","url_meta":{"origin":4,"position":1},"title":"Load a CSV file into an ArrayList","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). It isn\u2019t hard to write code which iterates through files, cuts them up and loads them into an ArrayList. And if the delimiting character isn\u2019t a comma? No problem, it isn\u2019t hard to add that functionality. And if you want to skip the first set\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":19,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=19","url_meta":{"origin":4,"position":2},"title":"Create an enum dynamically","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). When creating an enum dynamically, there are two levels of difficulty. The first case is where the type of the enum is known at compile-time, but the value is not. In this case, we can use the valueOf method of the enum in question: MyEnum.valueOf(stringVar);\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=12","url_meta":{"origin":4,"position":3},"title":"Persisting a Collection with an arbitrary enum type","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). As we know, enums are great for storing (relatively) static domain information. But let\u2019s say we want an object which models (and can persist) a collection of elements where we are not sure at design time which domain information will be stored. For example, a\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":25,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=25","url_meta":{"origin":4,"position":4},"title":"Simple Database Population Tool","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). My source control contains many tables, many of which have dependencies on one another via foreign keys. When the table structures are being changed fairly regularly, it can be a pain to have to keep updating the database manually. Ant has a built in SQL\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":41,"url":"https:\/\/www.nedlowe.co.uk\/blog\/?p=41","url_meta":{"origin":4,"position":5},"title":"Dummy Files in Unit Tests","date":"January 2, 2014","format":false,"excerpt":"(Recovered from my old Blog). Let\u2019s say that you have an application which accepts a filepath as part of its interface. When unit testing, you may have some dummy files which you use to test the interface. However, getting the full path of these test files can be a pain.\u2026","rel":"","context":"Similar post","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4"}],"collection":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4"}],"version-history":[{"count":3,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions"}],"predecessor-version":[{"id":44,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions\/44"}],"wp:attachment":[{"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nedlowe.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}