yaws,erlyweb学习笔记

安装配置:yaws直接下载安装,erlyweb下载直接解压到erlang的lib下。
Yaws官网http://yaws.hyber.org/index.yaws
Erlyweb官网http://erlyweb.org/,,,,,入门教程
http://yarivsblog.com/articles/2006/10/27/introducing-erlyweb-the-erlang-twist-on-web-framworks/

 

yaws -i  启动yaws服务器

Yaws:restart()。重启yaws服务器,(每次修改内容都要重启?)

<!--EndFragment-->

 

 

安装遇到很多问题,不一一描述,注意路径 ,特别是ebin路径。

 

%%关于配置文件yaws.conf:
logdir = "C:\Yaws-1.88/logs"
%%特别注意资源文件目录
ebin_dir = "C:\Yaws-1.88/examples/ebin"
ebin_dir = "E:\test/YAWS/music/ebin"

%%一般是包含文件目录
include_dir = "C:\Yaws-1.88/examples/include"

# This is a debug variable, possible values are http | traffic | false
# It is also possible to set the trace (possibly to the tty) while
# invoking yaws from the shell as in
# yaws -i -T -x (see man yaws)
trace = false
<server localhost>
        port = 8080
        listen = 0.0.0.0
        docroot = "C:\Yaws-1.88/www"
%%cgi-bin访问路径中的标识,只要在localhost:8080/后面出现即可,不一定紧挨着8080/。
%%yaws_appmod_cgi是要跳转到的模块的名字(和路径无关,只是module名字)。
        appmods = <cgi-bin, yaws_appmod_cgi>        
</server>

<server localhost>
 		port=8088
 		listen=0.0.0.0
 	docroot = E:\test/YAWS/music/www
appmods = <"/music",erlyweb>
<opaque>
  appname = music
</opaque>

</server>

<server localhost>
        port = 8087
        listen = 0.0.0.0
        docroot = "E:\test/YAWS"
        appmods = <test,myappmod>  
        <opaque>
  appname = music
  1=a
  2=b
</opaque>
</server>
 
 

<!--EndFragment--> <Opaque></opaque>内可以随便定义键值对,可以用A#arg.opaque去得其中的值,上面所取得值是A#arg.opaque=[{2,b},{1,a},{appname,music}].(不知道为什么是从下往上来的)。

 

 

 

ERROR erlang code crashed:
File: appmod:0
Reason: {no_application_data,Did you forget to call erlyweb:compile(AppDir) or add the apps previously compiled .beam files to the Erlang code path?}
Req: {http_request,GET,{abs_path,/music},{1,1}}

出现这个问题是因为ebin_dir路径不正确,要设置到myappebin

<!--EndFragment-->
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值