On Tue, Jan 15, 2013 at 10:22 AM, Roberto De Ioris <[email protected]> wrote:
>
>> Hi list,
>>
>> First, thank you very much for providing uwsgi.  I'm using it since
>> nearly 3 years for my applications, and I've seen constant progress
>> and improvements.  The Debian package is also great (although it
>> doesn't support pidfile2 but this is another story).
>>
>> Let me explain a usecase we have at my company, for providing
>> hot-reload to Python developers.
>>
>> In /etc/uwsgi/apps-enabled I request Chef to generate one app config
>> for each developer.  Here is the Chef template I use:
>>
>> {
>>     "uwsgi": {
>>         "touch-reload": <%= (Dir.glob(@app_dir + "/*/*.py") +
>> Dir.glob(@app_dir + "/*.py") + Dir.glob(@app_dir + "/ui/*/*.tmpl") +
>> Dir.glob(@app_dir + "/ui/*.tmpl")).inspect %>,
>>         "module": "server:application",
>>         "pythonpath": <%= [@app_dir + "/core"].to_json %>,
>>         "uid": "www-data",
>>         "gid": "www-data"
>>     }
>> }
>>
>>
>
> What about using py-auto-reload option ?
>
> Note: it is good only for development as it spawns a pretty heavy thread
> monitoring modules

i posted this in IRC last week:

http://vpaste.net/hliHi

--------------------------------------------------
#!/bin/bash


IFS=$'\n'
shopt -s extglob nullglob


i=0
v=${VIRTUAL_ENV}
f=$(readlink -f ${BASH_SOURCE[0]})
c=$(cd $(dirname ${f}) && pwd)/
b=$(cd $(dirname ${c}) && pwd)/
t=( ${b} ) &&
    [[ ${v:0:${#b}} != ${b} ]] &&
    [[ -n ${CONFD_VIRTUAL_ENV} ]] &&
    t+=( ${v} )


out () { echo "${@}"; }
msg () { echo "${@}"; } >&2
wnd () { COLUMNS=$(tput cols); LINES=$(tput lines); }
sep () { printf %s "${s[@]:0:${1:-${COLUMNS:-80}}}"; echo; } >&2
s=( {,,,,}{,,,}{-,-}{,,,}{,,,,} )
trap wnd SIGWINCH; wnd


out '[uwsgi]'
while read -r x; do out ${x}; let i++; done < <(
    find "${t[@]%%/}" -regextype posix-egrep \
        '(' -regex '.*/([:alnum:]*[.]git|man)' -prune ')' -o '(' '(' \
            -regex '.*[.](py|ini|xml|css|js|json)' \
            ')' -printf 'touch-reload = %p\n' \
        ')'
    )


sep
msg "INFO: watching ${i} files ..."
sep
--------------------------------------------------

...similar to original, but dynamically generated with --ini
exec://touch-reloader

-- 

C Anthony
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to