今天有想着瞎折腾了,帮老师改毕业设计还早着,但是实在不想写,可能因为感冒不爽。还是对不了解的东西感兴趣,然后开始了。 找到两个库,cl-http和hunchentoot,一个重量级,一个轻量级。选择后者了,因为只是想玩玩,写的代码肯定helloworld水平,just do it。 主要参考文章:http://blog.csdn.net/cx1468059916/article/details/8262515很详细 1.安装sbcl,执行命令:sudo apt-get install sbcl,sbcl好像是开源里边最受欢迎的。 2.安装quicklisp,是进行库管理的,方便安装。 下载quicklisp。wget http://beta.quicklisp.org/quicklisp.lisp 进入sbcl,载入:* (load "quicklisp.lisp") 安装(quicklisp-quickstart:install) 每次启动sbcl,载入sbcl,(ql:add-to-init-file) 安装库:(ql:quickload "system-name") 在命令执行过程中会有提示。 3.安装hunchentoot:* (ql:quickload "hunchentoot")其中安装了好多依赖库, 安装html-template:* (ql:quickload "html-template") 4.写程序:
(asdf:oos 'asdf:load-op :hunchentoot)
(asdf:oos 'asdf:load-op :html-template)
(defun myserver ()
  (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 8080))

  (hunchentoot:define-easy-handler (greet :uri "/hello") ()
                    (setf (hunchentoot:content-type*) "text/html; charset=utf-8")
                    (with-output-to-string (stream)
                       (html-template:fill-and-print-template
                        #p"hello_world.html"
                        ()
                        :stream stream))))
5.运行: * (load "hello_world.lisp") * (myserver)

上一篇:
下一篇:

相关文章:

Categories: 博客记录

7 Responses so far.

  1. fish 说:

    hi. 我运行了* (load "quicklisp.lisp") 但并未显示quicklisp quickstart loaded 而是显示: debugger invoked on a UNBOUND-VARIABLE in thread #: The variable “ is unbound. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level. (SB-INT:SIMPLE-EVAL-IN-LEXENV “ #) 0] 如何解决此错误?

    • hi. 我运行了* (load "quicklisp.lisp") 但并未显示quicklisp quickstart loaded 而是显示: debugger invoked on a UNBOUND-VARIABLE in thread #: The variable “ is unbound. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level. (SB-INT:SIMPLE-EVAL-IN-LEXENV “ #) 0] 如何解决此错误?

    0X55AA 说:

    哦 我可能编辑器 给我把标点符号改了, 变成中文的引号了,你把引号改成 英文的试一试, 我工作电脑上没有cl 不能帮你看看了

  2. fish 说:

    hi. (quicklisp-quickstart:install)好像没运行成功,如何解决? ==== quicklisp quickstart loaded ==== To continue with installation, evaluate: (quicklisp-quickstart:install) For installation options, evaluate: (quicklisp-quickstart:help) * (quicklisp-quickstart:install) debugger invoked on a SIMPLE-ERROR in thread #: Quicklisp has already been installed. Load #P"/root/quicklisp/setup.lisp" instead. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [LOAD-SETUP] Load #P"/root/quicklisp/setup.lisp" 1: [ABORT ] Exit debugger, returning to top level. (QUICKLISP-QUICKSTART:INSTALL :PATH NIL :PROXY NIL) 0]

  3. fish 说:

    楼主有linux vps吗?试试搭建这个:https://github.com/redline6561/coleslaw/,看能否搞得定?

    • hi. (quicklisp-quickstart:install)好像没运行成功,如何解决? ==== quicklisp quickstart loaded ==== To continue with installation, evaluate: (quicklisp-quickstart:install) For installation options, evaluate: (quicklisp-quickstart:help) * (quicklisp-quickstart:install) debugger invoked on a SIMPLE-ERROR in thread #: Quicklisp has already been installed. Load #P"/root/quicklisp/setup.lisp" instead. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [LOAD-SETUP] Load #P"/root/quicklisp/setup.lisp" 1: [ABORT ] Exit debugger, returning to top level. (QUICKLISP-QUICKSTART:INSTALL :PATH NIL :PROXY NIL) 0]

    0X55AA 说:

    你应该是 load没成功好像,成功了话 都有提示 你按照提示可以一步一步操作 http://www.quicklisp.org/beta/

  4. fish 说:

    hi. 装好了quicklisp是否就等于装好了lisp?

  5. 0X55AA 说:

    不是的,你执行sudo apt-get install sbcl后 就已经安装成功了。 quicklisp是用来管理第三方包的,使你可以方便的安装。

Leave a Reply