How does one generally structure their source files for a multi-sectioned site?
I have a site that has several disparate sections, including:
1. main page, company information, etc. 2. portfolio of past works 3. client projects 4. various other interactive demos
When I initially setup the project, I put the source files for each section into it's own directory, and included it as a module in my main defsystem. The main dispatch table would branch from there using "create-prefix-dispatcher" and call a "dispatcher" method belonging to the appropriate module.
Each client project gets it's own source file and dispatcher, because they usually contain many unique sections themselves, such as pages for alpha demos, betas, etc. Some also need various dynamic features, too, so it's not as if I can just create some template system and pull unique data from a DB. I really need to be able to through up entirely new branches to the site on a weekly basis.
The main issue that I've faced so far is that I have to add any new files to the :components section of the main defsystem method, which is inconvenient.
It is very likely that I'm just not understanding the basics of setting up a lisp project, but I don't think most projects require the same structure as a large website. Please correct me if I'm mistaken.
I'd appreciate any suggestions, pointers, or advice that anyone might have.
Thanks.
-austin
On Tue, Aug 21, 2007 at 01:37:56PM -0400, Austin Haas wrote:
How does one generally structure their source files for a multi-sectioned site?
I have a site that has several disparate sections, including:
- main page, company information, etc.
- portfolio of past works
- client projects
- various other interactive demos
When I initially setup the project, I put the source files for each section into it's own directory, and included it as a module in my main defsystem. The main dispatch table would branch from there using "create-prefix-dispatcher" and call a "dispatcher" method belonging to the appropriate module.
Each client project gets it's own source file and dispatcher, because they usually contain many unique sections themselves, such as pages for alpha demos, betas, etc. Some also need various dynamic features, too, so it's not as if I can just create some template system and pull unique data from a DB. I really need to be able to through up entirely new branches to the site on a weekly basis.
The main issue that I've faced so far is that I have to add any new files to the :components section of the main defsystem method, which is inconvenient.
It is very likely that I'm just not understanding the basics of setting up a lisp project, but I don't think most projects require the same structure as a large website. Please correct me if I'm mistaken.
I'd appreciate any suggestions, pointers, or advice that anyone might have.
For wigflip.com, I make new projects completely separate directories with their own version control, source files, static files, and foo.asd system. I have a dummy system called "load-wigflip" that :depends-on each of the projects that needs to be loaded.
Each of the projects depends on a "wigflip" system that adds convenience functions for carving out a portion of the URL space. There are also convenience functions to register the project in a way that makes a link to the project url space appear on the front page.
There are probably a zillion ways to structure a site. This has worked out for me so far. I can independently start up new subsections of the site without worrying too much about synchronizing them with the "main" site.
Zach
Thanks for the reply. That sounds great. I understand the concepts, but the implementation details are escaping me.
I'll have to mull it over for a while, but for starters, are you using a single Hunchentoot server, or one for each project/section?
-austin
On Tue, Aug 21, 2007 at 02:34:52PM -0400, Austin Haas wrote:
Thanks for the reply. That sounds great. I understand the concepts, but the implementation details are escaping me.
I'll have to mull it over for a while, but for starters, are you using a single Hunchentoot server, or one for each project/section?
Just one server. I'm not actually using hunchentoot, but its predecessor TBNL, but the concepts should be similar in this case.
Zach
Austin,
We used a similar approach for managing multiple client interfaces, by creating client-specific directories with one or more Lisp files with handler code. In our case, we dispatched based on the virtual host name, using the *META-DISPATCHER* special var.
Where we differed from the approach you wrote about is that we didn't use ASDF (or DEFSYSTEM) in loading the client specific sections. We used a simple mapping from the top-level URL prefix to Lisp file, which we just (load)ed.
For example, if the incoming request was for a "http://foo.com/users/list", then our *META-DISPATCHER* (which overrides the default) would look up a dispatch-table for "foo.com", and the default handler in that dispatch-table would look for a clients/foo.com/users.[ufasl | lisp] in the file-system, and load that into the running Lisp image. On loading users.ufasl, one or more explicit handlers for the /users prefix would be inserted into the dispatch table for subsequent request.
Hope this is useful.
-ram
On 8/21/07, Austin Haas austin@pettomato.com wrote:
How does one generally structure their source files for a multi-sectioned site?
I have a site that has several disparate sections, including:
- main page, company information, etc.
- portfolio of past works
- client projects
- various other interactive demos
When I initially setup the project, I put the source files for each section into it's own directory, and included it as a module in my main defsystem. The main dispatch table would branch from there using "create-prefix-dispatcher" and call a "dispatcher" method belonging to the appropriate module.
Each client project gets it's own source file and dispatcher, because they usually contain many unique sections themselves, such as pages for alpha demos, betas, etc. Some also need various dynamic features, too, so it's not as if I can just create some template system and pull unique data from a DB. I really need to be able to through up entirely new branches to the site on a weekly basis.
The main issue that I've faced so far is that I have to add any new files to the :components section of the main defsystem method, which is inconvenient.
It is very likely that I'm just not understanding the basics of setting up a lisp project, but I don't think most projects require the same structure as a large website. Please correct me if I'm mistaken.
I'd appreciate any suggestions, pointers, or advice that anyone might have.
Thanks.
-austin
-- Austin Haas Pet Tomato, Inc. http://pettomato.com
tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
Yes, your solution solves my main gripe and seems pretty easy to adapt my existing code to. Thanks!
Zach's solution is very interesting to me, though. With his method, it sounds like one could possibly run a section standalone, or even from another lisp image, and then (if desired) merge it into the main site once it's stable.
Thanks for the input.
-austin