Il giorno 07/mar/2011, alle ore 11.46, Łukasz Wróblewski ha scritto: > > > ----- Oryginalna wiadomość ----- >> Od: "Roberto De Ioris" <[email protected]> >> Do: "uWSGI developers and users list" <[email protected]> >> Wysłane: poniedziałek, 7 marzec 2011 11:08:51 >> Temat: Re: [uWSGI] uWSGI 0.9.7-beta1 - emperor >> >> Ok, now it is clear to me what you are trying to accomplish. >> >> Pratically you need in vassals the directory from which they are >> spawned (before every chdir()) > > I guess I explain it wrong :] > > My configuration file looks like this: > [uwsgi] > socket = /tmp/uwsgi/p1.sock > chdir = /home/a/p1 > spooler = /home/a/p1/data/spooler > logto = /home/a/p1/data/uwsgi.log > pidfile = /home/a/p1/data/uwsgi.pid > > And I would like to write only onece path to the project (application / > vassal). > Often, the paths are long. > > One of the things that came to my mind, it is saved to the variable value > "chdir" from configuration file. > Something like that: > http://docs.python.org/library/configparser.html#examples > """ > config.set('Section1', 'bar', 'Python') > config.set('Section1', 'foo', '%(bar)s is %(baz)s!') > """ > > I'd love to: > > [uwsgi] > socket = /tmp/uwsgi/p1.sock > chdir = /home/a/p1 > > spooler = %(chdir)/data/spooler > logto = %(chdir)/data/uwsgi.log > pidfile = %(chdir)/data/uwsgi.pid >
This will need a two-pass parsing, but now i have realized that is easier than i thought as we already have a dictionary of options (the one exported by uwsgi.opt) after the first read. So the second pass is only a matter of substituting occurrence with the value in the dictionary > or %v instead of %(chdir) > > > My second thought is: Since I changed the current work directory, so why I > can't give relative path. So it would be best. I know that this is not easy > to do. > > [uwsgi] > socket = /tmp/uwsgi/p1.sock > chdir = /home/a/p1 > # Since I changed the current work directory: > spooler = data/spooler > logto = data/uwsgi.log > pidfile = data/uwsgi.pid this should work out of the box (with pidfile as the only exception, but i will add a --pidfile2 soon) > > last commit is: > age author description > 2 hours roberto uWSGI 0.9.7-rc1default tip ops, i forgot to push it > -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
