Page 270 -
P. 270

controller code


           Control your code


          Your model code is ready, and you have a good idea of how the yate
           module can help you with your view code. It’s time to glue it all together
           with some controller code.
           First things first: you need to arrange your wedapp’s directory structure to
           help keep things organized. To be honest, anything goes here, although by
           giving it a little thought, you can enhance your ability to extend your webapp
           over time. Here’s one folder structure that Head First Labs recommends.

                                                                     As well as containing the subfolders, this folder
                                                                      contains your webapps “index.html” file, your
                  You can call your top-level                        “favicon.ico” icon, style sheets, and anything
                  folder anything you like.       webapp              else that doesn’t fit neatly into one of the

                                                                      subfolders.





                                                                            Any code that you write for
                                                                            your webapp needs to reside in a
                                                           cgi-bin          specially named folder called “cgi-
                                                                            bin”.


                                                                               Let’s keep the coach’s
                                                                               data files in a separate

                                                            data               folder by putting all of
                                                                               the TXT files in here.




                                                                            If your webapp has any images files
                        Do this!                           images           (JPGs, GIFs, PNGs, and so on), pop
                                                                            them into their own folder to help
                                                                            keep things organized.


            Head on over to the
            Head First Python support                                          The templates that
            website, download                            templates             came with the “yate.py”
            webapp.zip, and                                                    download can go in here.
            unpack it to your hard
            disk.



           234    Chapter 7
   265   266   267   268   269   270   271   272   273   274   275