Good question. I have the following layout, more or less inherited from the original developer (Hi Mike), but something that makes good sense to me:

/--| /code--| /bin /lib /web--| /html--| /images /cgi-bin /templates /utilbin /conf /data /logs /run /setup

Inside the code directory, the bin and lib directories are programs and libraries that the web application will use; there's a web directory that holds the static HTML pages (with a sub for images), the CGIs and the templates for the dynamic pages. The utilbin directory is for programs that are associated with the web application but that will usually be run from the command line -- sort of like an sbin for the application, I suppose.

Outside of the code directory I have directories for configuration files, data, log files, PID files and one for installation files.

An application that I'm in the process of developing uses the same directory structure, with the difference that below the templates directory I have two more directories, html and yaml, based on whether I'm outputing HTML web pages or YAML objects for the REST interface.

I like to have more, rather than less directories. I don't like to have everything in one directory -- yes, it's easy to find things, up to a point, then it starts to get hard to find things again.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds


In reply to Re: Organization of CGI application files by talexb
in thread cgi apps, is it bad juju to pile program and conf file, template, etc under one directory in cgi-bin? by leocharre

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.