[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
         web-server/servlet-env
         web-server/templates)

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


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

<html>
<head>

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

<body>
<h2>My Title </h2>

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

<ol>

<li> Item one

<li> Item two

</ol>

</body>

</html>

---------------------------------------------
style sheet

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


--------------------------------------------

Thank you in advance for any assistance.




Posted on the users mailing list.