Commit 10eee1d4 authored by Bruno's avatar Bruno

Merge pull request #24 from francisl/master

Python and django helpers
parents 0b936aaa 2a7ff8c2
# time, cleanup pyc and running test, settings as first argument
# e.g. djtest settings_dev
function djtest
set VERBOSE --verbosity=1
find . -name "*.pyc" -delete
if set -q argv
time python manage.py test $VERBOSE --settings=$argv
else
time python manage.py test $VERBOSE
end
end
# beautify json string
# use : pybeautifyjson '{"foo": "lorem", "bar": "ipsum"}'
function pybeautifyjson
echo $argv | python -mjson.tool
end
\ No newline at end of file
# clean current directory recursively from any .pyc and .pyo files
function pyclean
if test -n $argv
set path2CLEAN $argv
else
set path2CLEAN .
end
find $path2CLEAN -name "*.py[co]" -type f -delete
end
\ No newline at end of file
# start in-place a simple http server, take a optional parameter for the port number
function pyhttp
if test -n "$argv"
set HTTPPORT $argv
else
set HTTPPORT 1025
end
python -m SimpleHTTPServer $HTTPPORT;
end
# start smtp debugging server, can pass an option port parameter. Default to 1025
function pysmtp
if test -n "$argv"
set SMTPPORT $argv
else
set SMTPPORT 1025
end
echo "smtp server started on port" $SMTPPORT;
python -m smtpd -n -c DebuggingServer localhost:$SMTPPORT;
end
if test -d /usr/local/share/python if test -d /usr/local/share/python
set PATH /usr/local/share/python $PATH set PATH /usr/local/share/python $PATH
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment