[racket] Racket Web App

From: Stees, Micheal T. (MSTEES at monmouthcollege.edu)
Date: Tue Aug 30 14:49:01 EDT 2011

Hello all,

I am looking into using the racket web server and related tools to develop a webpage for a school project, and I have run into the following dilemma with the trivial example I am trying.

I have racket include an html template for the test site, and that html template references an external style sheet.  When I open the html file using a browser, it correctly displays the page based on the style sheet, but when I run my web app, it does not display things correctly.  Most specifically, it ignores the "background-image..." included in the style sheet.  I have included all the relevant code below.

#lang racket

(require web-server/servlet

(define (start req)
 200 #"Okay"
 (current-seconds) TEXT/HTML-MIME-TYPE
 (list (string->bytes/utf-8 (include-template "htdocs/base.html")))))

(serve/servlet start
               #:port 80
               ;;#:listen-ip #f
               #:servlet-path "/test")
html file


<title> HTML Sample </title>
<link rel="stylesheet" type="text/css" href="style.css" />

<h2>My Title </h2>

This is a <b>small</b> example of HTML <p> This is a new paragraph.<p>


<li> Item one

<li> Item two




style sheet

body {
    color: purple;
    background-image: url(lightning.png);


Thank you in advance for any assistance.

Posted on the users mailing list.