Tag archives: python

RSS feed of python

Unittest and reusable app

Published July 19, 2015 in Development - Last update on July 18, 2015.

You had fun, you wrote a Django third app. You should have write unittests before but you didn't know where to place them. For my case when I wrote Django Admin CLI I used the work made in Django Comments, let's explain it a little.

All testing code are stored in tests/ directory ...

Continue reading

Django Admin CLI

Published July 4, 2015 in Development, System administration - Last update on July 6, 2015.

I ever want to manage Django models directly from command line. In my dreams I have a curses script which have the same look and feel than Django Admin, in fact I created a CRUD application named Django Admin CLI. It is a Django third app linked to Admin's registry which allow DRY, easy ...

Continue reading

My Shell cheatsheet

Published June 25, 2015 in Development, System administration - Last update on July 8, 2015.

There are some tricks I do a long time ago then I forget or want to share:

Save time with history expansion

First daily use case, I want to run a command but I forgot to make it as root user.

$ ls /root/
ls: cannot open directory /root/: Permission denied
$ sudo !!
sudo ls /root/
file1 ...

Continue reading

Docking my blog

Published June 10, 2015 in Docker - Last update on July 6, 2015.

In my mind the master word of Docker is Fashion. So let's docker my blog ! It is a relativy a simple webapp, perfect for test Docker and micro-service architecture.

I won't make a new explanation of what are Docker and containers. For this kind of informations see the official doc. The great things ...

Continue reading

Django settings by environment

Published May 22, 2015 in Deployment, Development - Last update on July 6, 2015.

One thing not explained in Django Doc is how to make your project to live accross environments. Some settings need to have different values when used in production or testing, and testers might want to set their own values. A clear example is I wanna use a MySQL in production and SQLite in testing.

What ...

Continue reading

Python, table printing

Published May 21, 2015 in Development - Last update on July 6, 2015.

I always self-asked me how is the code used by mysql command for print tables. I ever don't know but I know how to do that in Python: With Format Specification Mini-Language.

Print a table

A script of my idea looks like this:

GUYS = ['tony', 'joe', 'ugo']
ROW_FORMAT = '| {0:5} | {1:30} |'

print(ROW_FORMAT ...

Continue reading