sono su Ubuntu 7.10, con YAWS installato tramite apt-getAll I’m documentating at this stage is the initial setup of a skeleton app, which starts with getting and building ErlyWeb:
svn co http://erlyweb.googlecode.com/svn/trunk/ erlyweb
cd erlyweb
mv Emakefile Emakefile.old
sed -e "s*/usr/local/src*/usr/local/lib*" Emakefile.old >Emakefile
make
cd ..
Note that I amended the Erlang makefile to point at the location of my installed YAWS includes from an earlier step. Now, back in the home directory, start Erlang with the following command line:
erl -pa erlyweb/ebin
In the Erlang shell, do this to create the skeleton application:
1> erlyweb:create_app("dj","/home/ciaran").
2> halt().
A ‘dj’ directory was created above with the skeleton ErlyWeb application structure in place. Add two extra files in that directory as follows. Firstly a small Erlang program which runs the app with YAWS in embedded mode - dj.erl. It’s just a slight extension of the embeded YAWS test code from last time:
-module(dj).
-export([start/0]).
-include("/usr/local/lib/yaws/include/yaws.hrl").
start() ->
erlyweb:compile("/home/ciaran/dj",[{erlydb_driver, mnesia}]),
application:start(yaws),
GC = yaws_config:make_default_gconf(false,"dj"),
SC = #sconf{port = 8001,
servername = "ubuntu01",
listen = {0,0,0,0},
docroot = "www",
appmods = [{"/", erlyweb}],
opaque = [{"appname","dj"}] },
yaws_api:setconf(GC, [[SC]]).
And secondly a script to compile and start it, called simply dj:
#! /bin/sh
erlc dj.erl
if [ $? -ne 0 ]; then exit; fi;
erl -pa /usr/local/lib/yaws/ebin /home/ciaran/erlyweb/ebin -yaws embedded true -s dj
Now to start things up:
chmod 770 dj
./dj
All being well, hitting port 8001 with a web browser should show the skeleton application, which doesn’t do very much at this stage. The choice of the name ‘dj’ for this first application indicates that I’m planning to replace the back-end of my inexplicable DJ software with this. It’s unlikely to be anything to get excited over, unless you’re me.
vorrei capire se
Codice: Seleziona tutto
sed -e "s*/usr/local/src*/usr/local/lib*" Emakefile.old >Emakefileil file in questione contiene
Codice: Seleziona tutto
{"src/erlyweb/*", [debug_info, {outdir, "ebin"}, {i,"/opt/local/lib/yaws/include"}]}.
%{"src/erlyweb/*", [debug_info, {outdir, "ebin"}, {i,"/Users/yariv/yaws/include"}]}.
{"src/erlydb/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlsql/*", [debug_info, {outdir, "ebin"}]}.
{"src/erltl/*", [debug_info, {outdir, "ebin"}]}.
{"src/smerl/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlang-mysql-driver/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlang-psql-driver/*", [debug_info, strict_record_tests, {outdir, "ebin"}]}.prima di far casino volevo solo essere sicuro di questo passaggio
grazie