Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic content doesn't work if server running with id other than "default" #66

Closed
yzh44yzh opened this issue Oct 23, 2011 · 0 comments
Closed

Comments

@yzh44yzh
Copy link

Hello.

I am using yaws in embedded mode in my app. I run it like this:

run() ->
Id = "my_server",
GconfList = [{id, Id},
{logdir, "./logs"},
{ebin_dir, ["./ebin"]}],
Docroot = "./wwwroot",
SconfList = [{port, 8888},
{servername, Id},
{listen, {127,0,0,1}},
{docroot, Docroot}],
{ok, SCList, GC, ChildSpecs} = yaws_api:embedded_start_conf(
Docroot, SconfList, GconfList, Id),
[supervisor:start_child(test_echo_sup, Ch) || Ch <- ChildSpecs],
yaws_api:setconf(GC, SCList).

It works ok with static pages, but when I try to open dynamic page it gives an error:

=ERROR REPORT==== 23-Oct-2011::16:35:13 ===
Yaws process died: {{badmatch,{error,enoent}},
[{yaws_compile,new_out_file,4},
{yaws_compile,compile_file,7},
{yaws_compile,'-compile_file/1-fun-0-',3},
{global,trans,4},
{yaws_server,do_yaws,4},
{yaws_server,aloop,3},
{yaws_server,acceptor0,2},
{proc_lib,init_p_do_apply,3}]}

I find out that error goes from here:
yaws_compile.erl line 312
new_out_file(Line, C, Tail, GC) ->
Module = new_out_file_module(Tail),
OutFile = new_out_file_name(Module, GC),
?Debug("Writing outout filesn", [OutFile]),
{ok, Out} = file:open(OutFile, [write]),

I build yaws with debug mode enabled and saw it tries to open file
~/.yaws/yaws/my_server/m1.erl
but there is no "my_server" dir in ~/.yaws/yaws. There is only "default" dir here.

After creating "my_server" dir manually, yaws works properly.

So the problem is that yaws doesn't create all directories when compile new module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants