How to set up a minimal wub that serves static web pages from "/"

30 views
Skip to first unread message

mb

unread,
Apr 19, 2011, 1:25:50 PM4/19/11
to Wub Discussion
I found a bunch of wub examples on the wubwikit site (linked to from
the wub wiki page).

http://code.google.com/p/wubwikit/downloads/list Follow that link and
download either eurotcl2009-examples.zip

I downloaded those examples but none of them work. I believe it's
because of the changes that have been made to the way Config works.

Is there an easy way to mimic example #1.

--------------- ex.tcl ----- from ex1 directory ---------
lappend auto_path ../Wub ../tcllib/modules .

package require Site

Site start home .
-------------------

There is a docroot under the current directory that contains html
files.
I think if this example worked, I'd be able to navigate to
http://localhost:8080/html/ex.html


What is the new process for setting up this minimal configuration if I
have a docroot filled with static .html files, and i want those files
mounted at / (http://localhost:8080/)?


I tried creating the following Application.tcl

-----------Application.tcl -----------------------
#! /usr/bin/env tclsh

## My Application needs to know how to find Site.tcl.
lappend auto_path [file join [file dirname [info script]] ../Wub]
package require Site

Site start home .

------ end Application.tcl -------------------

and the following Site.config

---------------site.config -----------------------
Wub {
globaldocroot 1; # do we use Wub's docroot, or caller's
docroot [file join [file dirname [info script]] docroot]; #
essentially ./docroot
}

/ {
domain File
root $Wub::docroot
}

default {
url default
code {set r [Http NotFound $r]; <p> "[dict get $r -uri] Not
Found... [clock format [clock seconds]]"}
}
------------------ end site.config -------------------


when I navigation to "/", I keep getting the 'not found' response from
default.



I am able to get static pages served up if I set up a file File domain
on something besides "/"

for instance,

/myApp/ {
domain File
root $Wub::docroot
}

will work if I navigate to
http://localhost:8080/myApp/


Just curious if I'm doing something obviously wrong, or if you just
aren't allowed to hang a File domain off of "/".

Thanks in advance for any advice.

MB

mb

unread,
Apr 29, 2011, 2:22:35 PM4/29/11
to Wub Discussion
I think I found my own answer.

>## the special URL 'default' determines Wub's behavior
>## when a URL can't be resolved
> default {
>     url default
>     code {set r [Http NotFound $r]; <p> "[dict get $r -uri] Not Found... [clock format [clock seconds]]"}
> }
>


There is a conflict when using both "/" and "default".
the default handler seems to always win.

I think the minimal amount of code to set a basic web server to set up
static pages is the following.
it assumes an Application.tcl, site.config file and a docroot
directory in a directory that is a sibling of wub.


----------- Application.tcl ------------------------

set script_dir [file normalize [file dirname [info script]]]
lappend auto_path [file normalize [file join $script_dir .. wub Wub]]

package require Site
Site init config [file join $script_dir site.config]

Site start

---------end -- Application.tcl ------------------------

and a site.config file

---------- site.config -------------------------------------

/ {
domain File
### info script returns the "main" script. (Application.tcl)
root [file normalize [file join [file dirname [info script]]
docroot]]
}
----------------- end site.config -------------------------

mcccol

unread,
Apr 29, 2011, 11:36:18 PM4/29/11
to wub-dis...@googlegroups.com


On Saturday, 30 April 2011 04:22:35 UTC+10, mb wrote:

I think the minimal amount of code to set a basic web server to set up
static pages is the following.
it assumes an Application.tcl, site.config file and a docroot
directory in a directory that is a sibling of wub.

Try dispensing with Application.tcl and just starting the server by running Site.tcl ... I think that should work, as Site.tcl's default behaviour when run as a command is roughly what you outline in your example Application.tcl.  If it doesn't work that way, it should, and I'll modify it to suit.

Come to think of it, I probably ought to rename Site.tcl to Wub.tcl.

Colin


PRISON K2SHEET

unread,
May 19, 2026, 3:26:01 PM (6 days ago) May 19
to Wub Discussion
Buy K2 SPRAY, K2 SPICE, K2 A4 SHEETS Coke , DMT , Shrooms , MDMA , Ket , Dexies or LSD .thc vape juice https://t.me/psychedelicstribestore
Buy K2 Paper Sheets & Legal High Spice K2 Spray https://t.me/psychedelicstribestore
@Jscreg Order K2 Spice Paper Online, 
Buy K2 Spice Sheets, https://t.me/psychedelicstribestore @Jscreg K2 Powder For Sale Online, 
Order K2 Powder Online, https://t.me/psychedelicstribestore 
@Jscreg 
Buy K2 Powder Online, Buy K2 Spray Online, https://t.me/psychedelicstribestore 
@Jscreg Buy K2 SPICE,
 Buy legal high K2 Spice Paper We have infused the paper with the best liquid incense out there. We also have K2 Spray for sale. Each A4 sheet is infused with 25 ml=0.845351 fluid oz of liquid K2. Buy wholesale K2 paper here https://t.me/psychedelicstribestore 
@Jscreg spice paper /spice spray/ prison spice K2 sheet For Sale Ireland: in Ireland Dublin Cork Ireland Galway Ireland Limerick Ireland Waterford Ireland Kilkenny Ireland Belfast K2 Sheets in Derry Ireland Armagh Ireland Ireland Ireland https://t.me/psychedelicstribestore K2 Spice paper K2 paper Mamba paper K2 Spray -Legal High K2 Spray & K2 Spice Paper -Buy K2 Spice paper, K2 paper,Mamba paper,K2 Spray Each A4 sheet is infused with 25ml = 0.845351 fluid oz of liquid K2 & or with others. You can buy the infused A4 Plain paper and write a letter to send to your buddy in prison. This paper is odorless and colorless. K2 Spice paper K2 paper Mamba paper K2 Spray A4 sheet with types of infused Incense K2 infused papers for sale K2 infused sheet for sale Telegram: @Jscreg https://t.me/psychedelicstribestore spice paper /spice spray/ prison spice K2 sheet For Sale: in Ireland Ireland USA Ireland Norway France Italy Ireland K2 Sheets in Ireland Denmark Sweden Ireland Belgium Poland
Shop the strongest K2 spray on paper at K2 Infused Paper https://t.me/psychedelicstribestore. Discover premium K2-infused paper,@Jscreg liquid incense, and K2 products with fast USA shipping. https://t.me/psychedelicstribestore Buy K2 online securely, with overnight delivery available. Explore our full range of K2 sprays and infused papers now

Buy K2 Paper Sheets Spray online, Buy K2 Spray Liquid Paper

Spice Papers K2 and A4 k2 paper sheets spraying k2 on paper is another option to discover the world of improved paper experiences in addition to diablo k2 spray bottle on paper and Liquid. These specialist papers contain diablo k2 liquid spray on paper.

In other words, K2 paper sheets are sheets that have the K2 medication infused into them. Depending on your budget, we provide both expensive and inexpensive K2 paper sheets. Since k2 liquid is sprayed or instilled onto the paper, liquid K2 paper sheets is another term for k2 paper sheets.


@Jscreg

Buy K2 Paper online at cheap prices. Each A4 sheet infuses with 25 ml=0.845351 fluid Oz of liquid K2. You can buy the legal infused A4 plain paper or already presoaked paper. We have special A4 K2 infused paper sheets for sale at low cheap prices. K2 spice paper, K2 paper either way is so strong and it will blow your mind off. We are always at your order if you want to Buy our Legal High K2 Spice Infused and soaked papers online.


@Jscreg

Shop the strongest K2 spray on paper at K2 Infused Paper https://t.me/psychedelicstribestore. Discover premium K2-infused paper,@Jscreg liquid incense, and K2 products with fast USA shipping. https://t.me/psychedelicstribestore Buy K2 online securely, with overnight delivery available. Explore our full range of K2 sprays and infused papers now

Buy K2 Paper Sheets Spray online, Buy K2 Spray Liquid Paper

Spice Papers K2 and A4 k2 paper sheets spraying k2 on paper is another option to discover the world of improved paper experiences in addition to diablo k2 spray bottle on paper and Liquid. These specialist papers contain diablo k2 liquid spray on paper.

In other words, K2 paper sheets are sheets that have the K2 medication infused into them. Depending on your budget, we provide both expensive and inexpensive K2 paper sheets. Since k2 liquid is sprayed or instilled onto the paper, liquid K2 paper sheets is another term for k2 paper sheets.


@Jscreg

Buy K2 Paper online at cheap prices. Each A4 sheet infuses with 25 ml=0.845351 fluid Oz of liquid K2. You can buy the legal infused A4 plain paper or already presoaked paper. We have special A4 K2 infused paper sheets for sale at low cheap prices. K2 spice paper, K2 paper either way is so strong and it will blow your mind off. We are always at your order if you want to Buy our Legal High K2 Spice Infused and soaked papers online.


@Jscreg
Reply all
Reply to author
Forward
0 new messages