Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  How to create twoorl application?

frankpengca
Posted: Sun Jul 12, 2009 11:37 pm Reply with quote
Joined: 12 Jul 2009 Posts: 4
Hi, gurus!

I am trying to get twoorl to work with erlyweb 7.1.

1. I cannot make the yaws.conf to point to my /usr/local/twoorl/www before I create it. If I do so, yaws -i will have error because there is no such directory exist for now.
2. If I erl and do a erlyweb:create_app("twoorl","/usr/local"). I will get an index.html file which is not about twoorl. The index.html is the same as in the music tutorial. Nothing with twoorl.

So, I did not create the application directory struture and I get into yaws -i.

I did a erlydb:start(mysql,[{hostname,"localhost"},....

Then I did a erlyweb:compile("/usr/local/twoorl",[{erlydb_driver,mysql}]).

Finally, I did a twoorl:start().

I did not find error message.

But when I http://localhost/
It gives me error messages:


ERROR erlang code crashed:
File: appmod:0
Reason: {badarith,[{paging_controller,index,4},
{erlyweb,ewc,2},
{erlyweb,render_subcomponent,2},
{erlyweb,'-ewc/2-lc$^0/1-0-',2},
{erlyweb,'-ewc/2-lc$^0/1-0-',2},
{erlyweb,ewc,2},
{erlyweb,render_subcomponent,2},
{erlyweb,'-render_response_body/7-fun-0-',6}]}
Req: {http_request,'GET',{abs_path,"/"},{1,1}}
Stack: [{twoorl_app_controller,error,
[{arg,#Port<0.4865>,
{{192,168,0,9},64414},
{headers,"keep-alive",
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"192.168.0.87",undefined,undefined,undefined,undefined,
undefined,undefined,undefined,
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.10, Ant.com Toolbar 1.3 (.NET CLR 3.5.30729)",
undefined,[],"300",undefined,undefined,undefined,
undefined,undefined,undefined,
[{http_header,9,'Accept-Charset',undefined,
"ISO-8859-1,utf-8;q=0.7,*;q=0.7"},
{http_header,10,'Accept-Encoding',undefined,
"gzip,deflate"},
{http_header,11,'Accept-Language',undefined,
"en-us,en;q=0.5"}]},
{http_request,'GET',{abs_path,"/"},{1,1}},
undefined,"/",undefined,[],"/usr/local/twoorl/www","/",
"/usr/local/twoorl/www",undefined,undefined,<0.764.0>,
[{app_data_module,twoorl_erlyweb_data},{"appname","twoorl"}],
[],[],undefined},
{ewc,main_controller,main_view,index,
[{arg,#Port<0.4865>,
{{192,168,0,9},64414},
{headers,"keep-alive",
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"192.168.0.87",undefined,undefined,undefined,
undefined,undefined,undefined,undefined,
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.10, Ant.com Toolbar 1.3 (.NET CLR 3.5.30729)",
undefined,[],"300",undefined,undefined,undefined,
undefined,undefined,undefined,
[{http_header,9,'Accept-Charset',undefined,
"ISO-8859-1,utf-8;q=0.7,*;q=0.7"},
{http_header,10,'Accept-Encoding',undefined,
"gzip,deflate"},
{http_header,11,'Accept-Language',undefined,
"en-us,en;q=0.5"}]},
{http_request,'GET',{abs_path,"/"},{1,1}},
undefined,"/",undefined,"/main","/usr/local/twoorl/www",
"/","/usr/local/twoorl/www",undefined,undefined,
<0.764.0>,
[{app_data_module,twoorl_erlyweb_data},
{"appname","twoorl"}],
[],[],undefined}]},
{'EXIT',
{badarith,
[{paging_controller,index,4},
{erlyweb,ewc,2},
{erlyweb,render_subcomponent,2},
{erlyweb,'-ewc/2-lc$^0/1-0-',2},
{erlyweb,'-ewc/2-lc$^0/1-0-',2},
{erlyweb,ewc,2},
{erlyweb,render_subcomponent,2},
{erlyweb,'-render_response_body/7-fun-0-',6}]}}]},
{erlyweb,handle_request,6},
{yaws_server,deliver_dyn_part,8},
{yaws_server,aloop,3},
{yaws_server,acceptor0,2},
{proc_lib,init_p_do_apply,3}]




Before all of these, I made connection to mysql.
I download a file called twoorl_server.erl and put in the src directory.
I changed the twoorl_app.hrl and did erlc twoorl.erl
and in the twoorl directory I did a make clean and make. I have executed all sql scripts in imigration directory.

All of these have no error message until I http://localhost with it.

If I go to http://localhost/twoorl, it pop out the twoorl home page. I fill up the user name and email and password, then I click on submit. It went to /home and pop out the above error message.

I had checked into the database. The user really has inserted into the tables.


Thanks a lot!
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum