Yourlabs

python

django-autocomplete-light 3.5.0 jquery moving release

| by jpic | django-autocomplete-light python

Django-autocomplete-light 3.5.0 was released, including backward compatibility breaks.

Read More

django-autocomplete-light 3.4.1 bugfix release

| by jpic | django-autocomplete-light python
Django-autocomplete-light 3.4.0 introduced a regression in locale loading, it has been reported by Phil Gyford, thank you !

django-autocomplete-light 3.4.0 release

| by jpic | django-autocomplete-light python
This release re-enables Python 2 and Django 1.11 support, even though it doesn't pass all tests because tests rely on dicts being ordered by default which came in Python 3 Also, this release exits from using Django's vendored select2, and vendors select2 itself with a submodule again, this is to benefit from upstream bugfixes faster

yourlabsdjango-decision

| by jpic | python django
https://github.com/yourlabs/django-decision A Delegative Democracy implementation made in BlackLoop HackerSpace for Les Indignés back in the days I used to squatt hackerspaces in-between gigs (now running my own). It's a bit old but probably still valid, given the complexity is handled in SQL with a WITH RECURSIVE query. Anyway, hope this will inspire you ! Have a great week

sphinxextnapoleon-support-for-numpy-and-google

| by jpic | python
https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html Pretty nice alternative docstring syntax for argument description and much more !

pyfront: Meteorish django responsive frontend

| by jpic | python django django-channels
pyfront is a research project implementing data binding over django-channels.

how-it-works-django-front-end-validators

| by jpic | python django
https://johnfraney.github.io/django-front-end-validators/how_it_works/

yourlabsplaylabs

| by jpic | devops python ansible best-practice
https://github.com/yourlabs/playlabs GitHub release of part of my current production practice to Continuous Integration and Continuous Delivery. It's the main monolyth that combines well in CI with our Python & PHP distributions. Actually some parts of the monorepo in the process of being extracted and rewritten to smaller sized units and that's the development track that's issued recent tools such as cli2 that is the library for decorating another CLI in python extracted as a generic engine, base for djcli (also extracted from injected code from ansible django plugin), shyml, with other parts that are yet to be installed in a production pipeline such as ansible-apply ansible modern command line wrapper, compoctl docker-compose decorator that's shorter to write but also provides experimental commands to improve automated deployments, backups and restores. Read More

python-overtakes-javascript-as-most-questioned

| by jpic | python javascript
Python overtakes JavaScript as most questioned language

Django & JS research report

| by jpic | python django best-practice npm nodejs js
This article aims to report the current state of research about dealing with both JS and Django, for people that aim to primarly deal with Django and enjoy the same workflow they have with python package with their frontend development, and find patterns to connect them while keeping them loosely coupled at whatever limit feels right for them. Nuff said, let's hack ! crudlfap relies on django-webpack-loader, which does its job very well. Read More

nerdocs-gdaps

| by jpic | python django best-practice
https://gitlab.com/nerdocs/gdaps GDAPS - Generic Django Apps Plugin System Awesome app by Christian González, undergoing research & development for frontend framework plugin EPIC !!! This is the README so far: This library allows Django to make real “pluggable” apps. A standard Django “app” is reusable (if done correctly), but is not really pluggable, like being distributed and “plugged” into a Django main application without modifications. CAVE: This software is in a very early development state. Read More

shyml

| by jpic | python yaml bash
https://pypi.org/project/shyml/ Sh and Yml had a baby : ShYml.

ansible-compose: deploying docker-compose files over bare ssh

| by jpic | python devops ansible docker docker-compose
In kubernetes, we have the joy of applying configuration directly from maintainer repositories: kubectl apply -f https://raw.github.../setup.yml This allows each repository to maintain its own infrastructure configuration as code, and maintaining a core devops framework in between. You will have to deal with particular credentials, that you should use something else to generate and so on. On the other side of internet, happy docker-composers are also having a lot of fun maintaining them in repositories they contribute to. Read More

yourlabs/python container adds security audit tools

| by jpic | gitlab-ci security python gitlab best-practice
The new version of yourlabs/python docker image, which bundles npm and pip3 on alpine and a bunch of testing tools, was released with bandit and safety baked in. You can benefit from it in your Open Source software by adding .gitlab-ci.yml: py-sec-bandit:image:yourlabs/pythonscript:bandit-v-xcommands,tests{posargs:-rsrc}py-sec-safety:image:yourlabs/pythonscript:safetycheck

mapjoin

| by jpic | python
https://pypi.org/project/mapjoin/ Find str.join boring ? Try mapjoin ^^ Have a great day ;)

trioptimatriform

| by jpic | python django
https://github.com/TriOptima/tri.form An alternative to django forms that works with django models and offers a lot of unfrustrating features, tri.form by Anders Hovmöller. Make sure that you also take a look to all their other apps which are pretty interesting !

Automatic test rewrite for django-dbdiff/django-responsediff/cli2

| by jpic | python django best-practice tdd
Still in the competition for most code coverage with least test code that is written manually and needs to be maintained manually, all our test autowriting software has been updated to support a new environment variable : FIXTURE_REWRITE. Instead of deleting fixtures manually to regenerate them by running the tests, you can now just run your tests with the FIXTURE_REWRITE env var. This will overwrite the fixtures and make the tests look like it passed. Read More

zsimicsetupmeta

| by jpic | python continuous-delivery best-practice
https://github.com/zsimic/setupmeta If you're unhappy with the current state of your setup.py, you should definitely try setupmeta by famous haxor Zoran Simic. I've been upgrading my setup.py to setupmeta, which gives me 10 times more useful features than the crappy script I had in my delivery pipelines, and I'm going directly with setupmeta for all new packages. So far, we have at least the following packages with setupmeta (probably more): - cli2 - shyml - djcli - crudlfap - playlabs Even if you don't maintain python packages, I highly recommend that you check setupmeta because it's really well thought of. Read More

shyml

| by jpic | python yaml automation cli
https://pypi.org/project/shyml/ Shyml 0.7.0 release on PyPi.

open-source-software-playlabs

| by jpic | python ansible devops playlabs
https://yourlabs.io/oss/playlabs I have just rewritten the README for playlabs, my ansible wrapper command. Note that this software is still in pre-alpha/planning stage and should only be used in production by seasoned haxors. # Playlabs: the obscene ansible distribution DISCLAMER: maybe it even works for you, but that's far from garanteed so far. I love ansible most of the time, the rest of the time it makes me feel like it deserves better UX. Read More

djcli-11-screenshot

| by jpic | python djcli django
djcli 1.1 screenshot!

cli2: unfrustrating CLI for Python automation

| by jpic | python cli2
Sometimes I just want to execute a python callback and pass args/kwargs on the CLI, and not have to define any custom CLI entry point of any sort, nor change any code, typically when automating stuff, cli2 unfrustrates me (pun intended): cli2 yourmodule.yourcallback somearg somekwarg=foo Sometimes I just want to define a new command and expose all callables in a module and I can't just do it with a one-liner. Read More

crudlfap-live-example-on-replit

| by jpic | python django crudlfap
https://repl.it/@jpic/crudlfap

talks-details-pyparis-2018

| by jpic | python pyparis
http://pyparis.org/talks.html#core-python

renderentrypoint-tag-by-alihazemfarouk-pull

| by jpic | django javascript python
https://github.com/owais/django-webpack-loader/pull/182 django-webpack-loader code splitting support by @alihazemfarouk, that has a sister pull request.

djcli-cli-crud-for-django-demo

| by jpic | python django
https://asciinema.org/a/Jn3LB6TO7vWcf2xhZnGmwLJ86 For hacker only: Full feature CLI CRUD+ for Django vidéo demo.

djcli

| by jpic | python django best-practices
https://pypi.org/project/djcli/ The new CLI for Django that you will wonder how you lived without !

clitoo: make your python callbacks work in CLI too !

| by jpic | python best-practices
Clitoo makes your python callbacks work on CLI too ! This CLI can execute python callbacks with parameters. Clitoo recognizes 4 types of command line arguments: lone arguments are passed as args arguments with = are passed as kwargs dashed arguments like -f arrive in context.args dashed arguments like -foo=bar arrive in context.kwargs It doesn't matter how many dashes you put in the front, they are all removed. Read More

DevOps since 2005: a  retrospective

| by jpic | python ansible best-practice
This article shares some history of DevOps testing in France during the last few years. How it looked like when I started in the industry in 2004 and almost 15 years later today. Background Just a 1337c0d3 that somehow made it so far with the help of a lot of shadow hacking, now somewhat known as “DevOps” in some places … Pre-DevOps era: the obscurity In 2004 i was hacking for Jouve which had high tech digital printers which meant that they could make small batches of books, at the time where the market was filled with offset printers that made the minimal batch have to be 1500 or something. Read More

factory-dry-patterns-crudlfa-00-documentation

| by jpic | python django
https://crudlfap.readthedocs.io/en/latest/factory.html Probably my ugliest python hack, which I'm not proud about, but I live with it.

thommignotprocesscontroller

| by jpic | python best-practice automation
https://github.com/thommignot/processcontroller/blob/master/processcontroller/__init__.py How Thomas Mignot, YourLabs hacker, re-implemented pexpect in 2018 with less than 100 SLOCs. Sorry for windows support, it's not part of our plans. “Expect” a release in the following days (pun intended).

jet-back-office-totally-ready-to-run-your

| by jpic | python django
https://app.jetadmin.io/demo?utm_source=jet&utm_medium=banner&utm_campaign=github&utm_content=link&utm_term=promo Brilliant update for django-jet !

crudlfa-050-g-drive-ish-design

| by jpic | python django crudlfap
CRUDLFA+ 0.5.0, g-drive-ish design

clilabs 1.1.1 release

| by jpic | django python best-practice
Clilabs now benefit a new command that automates a series of 3 lines that's I've been typing over and over again during 10 years of Django hacking. $ clilabs help +django:settings Setting up django has failed ! DJANGO_SETTINGS_MODULE env var not set ! Show settings from django. How many times have you done the following ? python manage.py shell from django.conf import settings settings.DATABASES # or something Well it's over now ! Read More

djcli: the new Django automation CLI command

| by jpic | python django devops
djcli is the package , a new CLI under design phase, it is a simple python package, that provides a command with name djcli, to do more with Django on the CLI: $ pip install djcli find the content for this variable in your project manage.py $ export DJANGO_SETTINGS_MODULE=your.settings you will probably run this from your directory parent to manage.py: $ djcli create auth.user username=pony is_superuser=1 i just checked and chpasswd command in django supports only interactive $ djcli chpasswd /path/to/password username=pony Read More

extreme-devops-screenshot-where-you-see

| by jpic | python django best-practice devops playlabs
“Extreme DevOps” screenshot, where you see branchname == lastbuildjobname, designed for dynamic environments, demonstrates auto-deploy an environment per push on a subdomain with the branch name. From betagouv/MRS#636, with PlayLabs, currently in Alpha stage.

playlabs: 30 seconds overview

| by jpic | playlabs linux python ansible best-practice
Quick version of the previous article on playlabs $ playlabs Playlabs: the obscene ansible distribution. Init your ssh user with your key and secure sshd and passwordless sudo: playlabs init root@1.2.3.4 # all options are ansible options are proxied playlabs init @somehost --ask-become-pass Now your user can install roles: playlabs install docker,firewall,nginx @somehost And deploy a project, examples: playlabs @somehost deploy image=betagouv/mrs:master playlabs @somehost deploy image=betagouv/mrs:master plugins=postgres,django,uwsgi backup_password=foo prefix=ybs instance=hack env. Read More

PlayLabs: the Obscene Ansible Distribution, long version

| by jpic | python linux ansible best-practice playlabs
From baremetal to deploying docker images on a PaaS in one command ? PlayLabs is the result of a refactor of playbooks we've had in production for a while to acheive hackable docker-based PaaS. The refactor was designed to be Open Source, almost there to beta. PlayLabs combines simple ansible patterns with packaged roles to create a docker orchestrated paas to prototype products for development to production. PlayLabs does not deal with HA, for HA you will need to do the ansible plugins yourself, or use kubernetes … but until then, PlayLabs do everything else, even configure your own sentry or kubernetes servers ! Read More

Django tests that write themselves

| by jpic | python django best-practices
This is a plain advertisement for two excellent test utils maintained by YourLabs: django-dbdiff django-responsediff If you're volunteering on a project, and that there are many newbie contributors - who turn out to be militants with a high determination - then you definitively want to check out these apps as they will highly facilitate your volunteering in a project as sole professional dev.

open-source-software-django-collectdir

| by jpic | python django best-practice
https://git.yourlabs.org/oss/django-collectdir Want to split your react components accross your django apps or anything like that ? Try django-collectdir, which implements a instant realtime django-app directory watcher with beautiful colors for development !

django-autocomplete-light 3.3.2 release

| by jpic | python django django-autocomplete-light
3.3.2 fixes a regression with static files loading in django.contrib.admin that was introduced in 3.3.1 Note that it also supports Wagtail now, thanks to @coredumperror

jack-daniels-writes-to-python-language-programers

| by jpic | python lol
Jack Daniels writes to Python language programers on a delicious sunday afternoon.

django-autocomplete-light 3.3.1 release

| by jpic | python django django-autocomplete-light
Thanks to awesome contributors from all around the world, DAL 3.3.1 is out, one month after 3.3.0, that was the first non-rc release of 3.3.0 which starts to require Django 2.0. 3.3.1 Fixed a bug in the way jquery.init.js was being used by @coredumperror Set select2 container CSS class to :all: @hbielenia Added missing renderer parameter to render method for django 2.1 @monim67 Fix ImportError with SELECT2_TRANSLATIONS in Django 1. Read More

why-structlog-documentation

| by jpic | python
http://www.structlog.org/en/stable/why.html Structured logging, I wish I found out earlier !

djcall 0.0.5 release

| by jpic | python django uwsgi spooler cron
django-call is a model wrapper around uWSGI native cron and spooler features, including the signal framework allowing to program callbacks on cron or run them in a given spooler with a given priority for example. For example right now on a betagouv project it logs the following when uWSGI starts: [uwsgi-signal] signum 1 registered (wid: 0 modifier1: 0 target: worker) [djcall] uwsgi.register_signal(1, mrsstat.models.Stat.objects.create_missing) [uwsgi-signal] signum 2 registered (wid: 0 modifier1: 0 target: worker) [djcall] uwsgi. Read More

Django-autocomplete-light 3.3.0 release

| by jpic | python django-autocomplete-light django
Changes since 3.3.0-rc6: - use admin statics - #981: create option behaviour - #995: automatically generated views for generic foreign key fields - Getting placeholder and minimumInputLength from dal select - #1017: Initial migrations and database - Turkish translation - Added support for forwarded fields to Select2GenericForeignKeyModelField Since 3.2.10: 3.3.0-rc6 #959: Django 2.0 widgets may load jQuery after dal #959 3.3.0-rc5 #895: Self() and JavaScript() forward features 3. Read More

yourlabsdjango-uwsgi-spooler

| by jpic | python django uwsgi django-uwsgi-spooler
https://github.com/yourlabs/django-uwsgi-spooler Finnaly a Django app to wrap around uWSGI's builtin spooler ! I should have done this years ago, but I was expecting to make a boring module, it turned out a lot more exciting than expected ! First things first, django-uwsgi-spooler has only one expectation from your callbacks: be an importable function and take a task argument. The only other expectation is that you can use the Task model it provides, for example: Task(callback_name='yourmodule. Read More

django-21-released-weblog-django

| by jpic | python django
https://www.djangoproject.com/weblog/2018/aug/01/django-21-released/ Gratz for another amazing release !

nagare-integrated-development-environment-nagare

| by jpic | python framework django best-practice
http://www.nagare.org/ide/guide.html#debugging Nagare, a brilliant Python framework definitely worth studying ;)

tbinetruychip

| by jpic | python best-practice
https://github.com/tbinetruy/CHIP Python's functional implementation of ReactJS, fast moving and very promising, by YourLabs Dev Team ! Thomas Binetruy has taken over jpic's PoC of React in Python, which I've also seen an implementation attempt in the v2 branch of django-material. This is part of the milestone of migrating from MaterializeCSS to Material Design Components Web in CRUDLFA+. But know that YourLabs has never released any Django form rendering plugin so far. Read More

Pip exception TypeError: parse() got an unexpected keyword argument 'transport_encoding'

| by jpic | python pip
I had an old html5lib installed with –user, that would break globally installed pip from my Arch Linux system. Posting the solution that worked for me here because i couldn't find it elsewhere: pip uninstall html Uninstalling html5lib-0.9999999: Would remove: /home/jpic/.local/lib/python3.6/site-packages/html5lib-0.9999999-py3.6.egg-info /home/jpic/.local/lib/python3.6/site-packages/html5lib/* Proceed (y/n)? y Successfully uninstalled html5lib-0.9999999 Then, pip install --user worked again. The full traceback was: Traceback (most recent call last): File “/usr/lib/python3.6/site-packages/pip/_internal/basecommand.py”, line 228, in main status = self. Read More

breve-demonstration-de-certains-des-developpements

| by jpic | python crudlfap
I had an old html5lib installed with –user, that would break globally installed pip from my Arch Linux system. Posting the solution that worked for me here because i couldn't find it elsewhere: pip uninstall html Uninstalling html5lib-0.9999999: Would remove: /home/jpic/.local/lib/python3.6/site-packages/html5lib-0.9999999-py3.6.egg-info /home/jpic/.local/lib/python3.6/site-packages/html5lib/* Proceed (y/n)? y Successfully uninstalled html5lib-0.9999999 Then, pip install --user worked again. The full traceback was: Traceback (most recent call last): File “/usr/lib/python3.6/site-packages/pip/_internal/basecommand.py”, line 228, in main status = self. Read More

in-the-first-screen-we-see-that-two-posts-in-the

| by jpic | python django crudlfap
In the first screen we see that two posts in the list have a different button in the Actions column. The first row is a post that I'm the owner of, therefore the Actions shows a button for a dropdown menu. The second row is a post that I'm not owner of, but that has been published, so, I only have the detail link on that row. In the second screenshot, using the checkboxes reveals possible groupped actions on the bottom of the screen, here “Delete objects” which serves as reference action. Read More

the-ultimate-guide-to-data-classes-in-python-37

| by jpic | python
https://realpython.com/python-data-classes/ Great article about Python 3.7 data classes !

how-to-put-a-nextjs-server-in-front-of-django-with

| by jpic | python django nextjs react django-appwatch
How to put a NextJS server in front of Django with django-appwatch In this article, we'll get started on a new Django project with NextJS in front of Django. We choose to put NextJS in front of Django because NextJS is an isomorphic UI framework for React, that's pretty simple to use. - Create your Django project as usual, - Do in your repo: yarn add next react - Install django-appwatch with pip install django-appwatch, - Add appwatch to INSTALLED_APPS, - Run command manage. Read More

open-source-software-djnext

| by jpic | python django javascript react djnext best-practice
https://git.yourlabs.org/oss/djnext Django-NextJS Isomorphic UI Development with Decorator pattern for Django with: - nextjs out of the box experience for frontend development, - rendering of nextjs pages with context in Django with NextJS template engine. For fun & profit ## Run the example project Run this commands as non root:: git clone https://git.yourlabs.org/oss/djnext cd djnext pip install –user –editable .[dev] yarn install djnext watchstatic # maintains nextjs pages/ directory for yarn dev yarn dev # run localhost:3000 djnext dev # run localhost:8000 ## Choose NextJS page template in Django Example project lives in src/djnext_example, see src/djnext_example/artist/urls. Read More

some-screenshots-from-a-backoffice-using-crudlfa

| by jpic | python django crudlfap
Some screenshots from a backoffice using CRUDLFA+

indietypdjango-automated-logging

| by jpic | python django best-practice
https://github.com/indietyp/django-automated-logging Pretty cool alternative to django.contrib.admin.LogEntry

still-finishing-crudlfa-framework-for-django-20

| by jpic | materializecss crudlfap python django turbolinks stimulusjs
Still finishing CRUDLFA+ framework for Django 2.0, see example esponsive detail page for BetaGouv with MaterializeCSS.

deploying-scalable-django-app-on-kubernetes

| by jpic | python django kubernetes best-practice
http://danielhnyk.cz/deploying-scalable-django-app-on-kubernetes/

CRUDLFA+ 0.3 Series

| by jpic | python django crudlfap
CRUDLFA+ is an expirement (read: pre-alpha state) of what Django could be if: generic views provided templates and javascript for a rich experience out of the box, class based views leveraged OOP a bit more to add DRY goodness, leveraged externals apps from the Django ecosystem. Let's compare it side by side. Consider this simple model: class Email(models.Model): email = models.EmailField() caisse = models.ForeignKey('Caisse', on_delete=models.CASCADE) def __str__(self): return self. Read More

delitamakandadjango-react

| by jpic | python django javascript react best-practice
https://github.com/delitamakanda/django-react Beautiful example of Django/React integration !

wildfish

| by jpic | python django javascript best-practice
https://github.com/wildfish Django isomorphic research !

is-everything-an-adapter-issue-40

| by jpic | python django adapters
https://github.com/mjtamlyn/django-adapters/issues/40 How adapters can be amazingly simple and fun !

Model in Django: not what you think they are

| by jpic | python django
It's funny how my imagination was completely anihilated when I actually read django model field source code. I thought a Django Model was dedicated to designing the database. But a Model field is not a DB Field. A Model field has a DB field, and a formfield method. Unfortunnately, formfield is not changeable unless you override the method which means creating your own model field. Also unfortunate, Model has no form() method like their fields have formfield() method. Read More

jpicdjango-adapters

| by jpic | python django best-practice adapters
https://github.com/jpic/django-adapters/blob/master/docs/source/tutorial.rst django-adapters new proposal ! This time less clumsy and I hope probably more like what Marc had in mind !

django-adapters audit writeup

| by jpic | best-practice python django
It's been probably 30 hours I've spent trying to contribute to the django-adapters. This article describes the approach we take when making investment audits on software @ YourLabs, and my conclusions on this project. I started by reading what had been done and issues. My first mistake was to not be patient enough to really read and profoundly understand absolutely every piece that had been done. It seems to me that what django-adapters tries to do is invent a new pattern to solve the kind of problems we usually deal with as developers: Read More

going-isomorphic-with-python-and-react

| by jpic | python javascript isomorphic turbogears
https://medium.com/@__amol__/going-isomorphic-with-python-and-react-f4664183f0c4 Great one <3

victory-on-javascript-lets-build-another-django

| by jpic | python django-dynamic-fields best-practice javascript
Victory on JavaScript, let's build another Django on top of Django :) With LOVE

Djangonauts: Say no to selenium drug

| by jpic | selenium best-practice python django js
When you start applying best development practices such as TDD, you discover that you make much better software. First, you can TDD your python code with anything, django has a test runner, otherwise you have pytest and many friends. Then, you make python to interact with javascript. In the Django community, it seems that there is a conscensus around “use selenium to test your JS”. I've been like this myself for years, but the thing with selenium is that it's functional testing, not unit testing, it does bring short term ROI, but on the long term it becomes costy to maintain over time. Read More

Django settings refactoring apps

| by jpic | django python
Found another way cool app shared by Linus Lewandowski on django-dev mailing list, here's the excerpt from django-12factor: “The Twelve-Factor App” is an awesome methodology for building SaaS apps. django-12factor makes Django more 12factor-y. Right now, this focuses on the Config - “Store config in the environment”; Heroku users with addons will be particularly familiar with this. Still not sure of the benefits? Check out “Twelve-Factor Config: Misunderstandings and Advice”. Read More

django-dbdiff 0.7.3 release

| by jpic | django-dbdiff python django
I'm pretty lazy when it comes to writing tests for existing code, however, I'm even lazier when it comes to repetitive manual testing action, catching up with untested legacy code when I want a lot of coverage now, at least to ease upstream dependency upgrade testing. PHPUnit has had a DBUnit component since at least 10 years, and Junit too, I ported the concept to Django, first in several apps. Extracted it in the package to de-duplicating the data import tests from django-representatives and django-representatives-votes which is re-used in django-cities-light. Read More

DAL 3.3.0-rc3 release

| by jpic | django-autocomplete-light python
Django-autocomplete-light 3.3.0-rc3 was released. Please try it out and submit feedback ! With LOVE jpic

django-autocomplete-light 3.3.0-rc1

| by jpic | django-autocomplete-light python
To install 3.3.0-rc1, use: pip install django-autocomplete-light==3.3.0-rc1 New features: @953: Select2 update to 3.4.0.6-rc.1 by @jpic @917: django-nested-admin support by @loicteixeira @815: Simplify customization of autocomplete views by @EvaSDK @746: Select2 Language and dynamic Media by @luzfcb @883: Allow overwriting the results by @eayin2 Bug fixes: @874: Fix Django 1.11.3 error by @ikcam @933: Python 3.6 and Django 2.0 support by @jpic @930: QuerySetSequence querysets order is not preserved by @melvyn-sopacua @909: Prevent initilization of other selects by @loicteixeira @904: Fix KeyError when id is not in attrs by @dwheaton @885: Prevent rendering of empty option on multi select by @johandc @892: Enable different item label for selected item by @maximpetrov @926: Atomic create_object by @jpic @718: Remove temp hack for select2 by @FuzzAU @860: dal: widgets: use the name if we don't have the id by @xrmx @849: Don't create a new option if an iexact-matching one already exists by @liwenyip Also thanks to the many documentation contributors. Read More

get_context_data() considered harmful

| by jpic | django python
Hello everybody <3 Let's talk about ideas for deprecation / discouraging the use of get_context_data(). get_context_data() is useful to support legacy templates from the pre-CBV era, since CBV we can now access any attributes from the view instance with {{ view }}. I've seen things like this in many projects, I wonder if it's the case for other people too: def get_context_data(self, **kwargs): c = super().get_context_data(**kwargs) c['something'] = self.something return c And I'm guilty as charged you can find commits from myself like this all over internet. Read More

WDB: the improbable web debugger for Python

| by jpic | python
Stumbled accross some really good looking web based debugger: https://github.com/Kozea/wdb

Getting generic views to support “fake” models

| by jpic | python django crudlfap
Sometimes, we need to make views around objects which are not stored in the database. They may be calculated on the fly in python, or come from some data source that's not the database, or which aggregates several objects in the database. This is supported out of the box with CRUDLFA+, the modern web framework for Django. All you need to implement is: a Model class with what you want in it, just set Meta. Read More

YourLabs Business Service is born

| by jpic | python django yourlabs crudlfap
It's my pleasure to announce the official birth of our new company, YourLabs Business Service. This company will work in conjunction with the YourLabs foundation and of course sponsor the Django apps ecosystem. We are hiring freelancers to: maintain apps in the Django ecosystem that we use in CRUDLFA+, our modern web framework for Django, sysadmins and other hackers to co-manage our infrastructure: respond to monitoring alerts and this kind of things, contribute to our customer projects, This is a 99% remote position, or 100% if you want to miss all the parties and conferences we'll setup or join, but it's not a full time job, yet, rather a paying side project for things you probably already do. Read More

What does the CRUDLFA+ acronym stands for ?

| by jpic | python django crudlfap
Well, it definitely stands for something ! And since this is becoming a FAQ, here's my answer: It stands for: Create Read Update Delete Form Autocomplete and more ! We started by making a CRUD because the customer was complaining his come was not DRY and that we should have a CRUD in Django - the customer comes from the modern PHP framework world. We soon figured we needed a crudL, for the list. Read More

django==2.0a1 released

| by jpic | django python
You can install it with: pip install django==2.0a1 Time to test some apps With <3

CRUDLFA+ 0.1.1 Video Demo

| by jpic | python django crudlfap
This is a quick video I made so our friends can see CRUDLFA+, the DRY framework for Django, looks like so far: With <3 Jamesy aka jpic

Rethinking Django’s URL Router

| by jpic | django python crudlfap
This all started when a web developer learning Django was struggling to maintain a quantity of HTML and came to me: “I have a question for you, Django, can you generate a menu for me please ?". Oh my, is this person going to be the next wasting their time building something that's too complicated and worthless just like I have back when I used to try this kind of stunt ? Read More

DAL 3.2.6 Release

| by jpic | django-autocomplete-light django python
django-autocomplete-light 3.2.6 was released on github and pypi, with: #838: Use namespaced jQuery in `get_forwards` by @ryan-copperleaf & @gagarski #836: Queryset sequence view to display actual model name by @jsoa 3.2.5 and 3.2.6 were briefly hosted on PyPi and are the same. Enjoy <3

django-autocomplete-light 3.2.4

| by jpic | django-autocomplete-light django python
#813: Return 400 on invalid input by @EvaSDK

django-autocomplete-light 3.2.3 release

| by jpic | django-autocomplete-light python django
3.2.3 Two seriously good community contributed bugfixes #799: Support serializing UUIDs and add tests for models with UUIDs as PKs by @blag #826: Prevent rendering of empty option on multi select by @beruic Bravo ! Tests are passing reliabily these days. The code climate is pretty sunny to contribute patches. Help wanted on unit tests: there is a bunch of units and currently everything is tested together with selenium. Read More

DAL 3.2.2: Django 1.11 support

| by jpic | django-autocomplete-light python django
django-autocomplete-light 3.2.2 was released, it supports django 1.11 and is not known to break backward compatibility.

Welcome Erik Telepovský as new release manager for django-session-security

| by jpic | django-session-security python django
Let's give a warm welcome to django-session-security‘s new release manager, Erik Telepovský from pragmaticmates.com.

django-session-security 2.5.0 release

| by jpic | python django django-session-security
DSS release 2.5.0 was published in PyPi: #79 remove compiled binary from source to comply with Debian source code repository policy by @nirgal #81 support django 1.10 by @eriktelepovsky #84 a11y support to modal dialog by @lynnco #85 support for mobile device activity by @kalekseev #88 dutch translation update by @rdekker1 #91 test django 1.11 and 2.0 instead of 1.7 by @jpic Rename default branch to master

Navigation Autocomplete with jquery-autocomplete-light

| by jpic | python javascript jquery-autocomplete-light
“How to make a navigation autocomplete with django-autocomplete-light v3” seems like a top FAQ since v3 release, because v2 included an example which was not reported inside the documentation of v3. While the example in v2 documentation is still valid, the autocomplete.js script was removed from django-autocomplete-light, and is now available in the jquery-autocomplete-light repository. Happy hollidays from the YourLabs panarchy :)

Django: status of 1.11

| by jpic | python django
Django 1.11 alpha is announced for January 16, review priority will be given to any ticket marked “ready for checkin” by January 9, Tim says, which means its still time to make a contribution to Django 1.11 ! The only “major feature” on the 1.11 roadmap is template-based widget re ndering which is (hopefully) in final reviews. There are still plenty of “patches needing review” if you want to help there. Read More

Django-autocomplete-light 3.2.0 release

| by jpic | python django-autocomplete-light django
We have two major features: Advanced field forward options, List based autocompletion. Complete changelog: #745: Add list autocomplete by @dmosberger, https://github.com/jpic and https://github.com/thecardcheat, #754: dal_queryset_sequence documentation update by @chubz #734: Move create_option functionality into it's own method @andybak #741: Fix initial value not set when selected choices aren't strings @thauk-copperleaf #733: Advanced forward features @gagarski #752: Add doc test to CI by @jpic #730: Resolve SystemCheckError fields.E304 @thecardcheat #721: Note about placement of DAL before grappelli by @chubz #748: Update docs example about loading jquery outside the admin @jpic

django-responsediff 0.7.1 released

| by jpic | python django django-responsediff
This release includes a bugfix for the new feature added in 0.7.0, occuring with non-ascii characters in selector-based tests with python 2. Fix by @njoyard, test case by @jpic.

yourlabs-security mailing list

| by jpic | python django security
This post announces the creation of a mailing list for security issues concerning yourlabs. Members can read messages, but external users may only post to it: yourlabs-security@googlegroups.com Thanks Clayton Delay for the suggestion. You may request to be part of the list here.

django-session-security 2.4.0 release

| by jpic | django python django-session-security
This new release enforces SESSION_EXPIRE_AT_BROWSER_CLOSE, because it makes no sense to use django-session-security without it, by design. However, a vulnerability caused by having SESSION_EXPIRE_AT_BROWSER_CLOSE disabled was fixed, thanks Clayton Delay for the report.

django-responsediff 0.7.0 release

| by jpic | python django django-responsediff
This new release includes: the possibility to filter content, contributed by @njoyard the possibility to crawl the website and test all pages

django-autocomplete-light 3.1.7 release

| by jpic | django-autocomplete-light python django
#714: Update select2 by @meesterguyman #705: Improve compat with dj1.9 by @9nix00 #706: Fix extra require by @blueyed #710: Added note for static files not checked by @geekashu #708: Provide path with dal_select2.E001 by @blueyed #700: Enable HTML markup in select2 item labels by @njoyard

django-cities-light 3.3.0 release

| by jpic | django python django-cities-light
Thanks to the amazing work by the YourLabs community, I'm proud to release 3.3.0 of django-cities-light: #118: Add Django 1.10 support, drop Django 1.7 support by @jpic #113: Fix DeprecationWarning by @mbaragiola #106: New management command to work with fixtures by @max-arnold #108: translation_items_pre_import_signal by @FaBay89 #106: New management command feature by @greeday2 Njoy B)

DAL 3.1.6 release

| by jpic | django python django-autocomplete-light
django-autocomplete-light v3.1.6 was released, thanks to these fine contributions: #671: Create_field support with querysetsequence by @jpic #679: Allow create message translation by @maisim #682: Extend ‘forward’ attribute to creating objects as well by @toudi #666: Improved missing ‘created_field’ error by @guettli #670: Javascript loading documentation by @jpic #678: Added example to update autocompletes in JS by @jpic

django-autocomplete-light 3.1.5 release

| by jpic | django python django-autocomplete-light
This release enables field-forwarding in formsets and forms with prefix. Also note that several things have been made to help users: a new tutorial section showing placeholder and minimum-input-length select2 options has been added and a system check will raise an error if select2's js is not present - typically for users who have git clone'd the repo without --recursive, resulting in a wc without select2. For devs, we've moved from django-sbo-selenium to pytest+splinter and it's pretty cool ! Read More

django-autocomplete-light 3.1.3 release

| by jpic | python django django-autocomplete-light
This release provides commit e612748 which fixes a bug in the TaggitSelect2 to reproduce the bugfix in 15f27871 that was issued in 3.1.2.

django-dbdiff 0.6.0 release

| by jpic | python django best-practice django-dbdiff
django-dbdiff was released. It allows to exclude fields from tests with the new exclude parameter, ie:: Fixture( 'tweets/tests/after_create_retweet.json', models=[Tweet, Retweets], ).assertNoDiff( exclude={ 'tweets.tweet': ['datetime'], 'tweets.retweets': ['datetime'], }, } This was initially requested by Nicolas Joyard for the Political Memory project. Note that you shouldn't use exclude for datetimes like in the above example, but instead use something like freezegun to force datetimes to an arbitrary fixture.

django-autocomplete-light 3.1.2 release

| by jpic | django python django-autocomplete-light
This posts announces the release of django-autocomplete-light 3.1.2: #634: Select2 Upgrade #628: Do not rely on ids to fix container text #631: Initializing GFKs with values from forms #623: Fix setup.py extras by @ticosax #610: Cancel out Django's style on lists Enjoy B)

Porting ModelForm enhancements from django-autocomplete-light v2 to Django

| by jpic | python django django-autocomplete-light xmodelform
Currently, django-autocomplete-light v2 provides enhancement to default form field generation for model fields, depending on the registered autocompletes, as shown in the tutorial. For v3, we don't want this feature inside DAL anymore because it has really nothing to do with autocomplete. Instead, I'm trying to contribute a generic way to do that. It would not benefit only django-autocomplete-light anymore, but all Django apps. You could get enhanced default form fields for model fields just by installing and configuring apps in your project. Read More

django-autocomplete-light v3: what’s going on

| by jpic | python django django-autocomplete-light
This post clarifies the status of django-autocomplete-light and strategy for v3. Version 2 No further effort will be made to support new versions of Django in v2. However, it supports the current LTS Django 1.8 and future-release Django 1.10, so we've got plenty of time to re-do v2's best features in v3 (in a better way) and most importantly you've got plenty of time to upgrade (until 2018). Version 3 It's a ground-up rewrite and it's not backward compatible - hence the 2 years upgrade plan. Read More

django-responsediff 0.3.0

| by jpic | python django best-practice django-responsediff
django-responsediff 0.3.0 has been released ! It now also checks the status_code, and has a cute mixin: from responsediff.test import ResponseDiffTestMixin class MixinTest(ResponseDiffTestMixin, test.TestCase): def test_admin(self): self.assertResponseDiffEmpty(test.Client().get('/admin/')) The above will fail on the first time with FixtureCreated to indicate that it has written responsediff/tests/response_fixtures/MixinTest.test_admin/{content,status_code}. This file is meant to be added to version control. So next time this will run, it will check that response.status_code and response.content is the same, in future version, or in other configurations (ie. Read More

Visual Python Profiler

| by jpic | python
Anybody tried the Visual Python profiler ?

django-jet: modern admin template

| by jpic | django python
Check out this nice django admin theme: django-jets.

django-autocomplete-light 3.0.0 release

| by jpic | django-autocomplete-light django python
After 4 years of supporting django-autocomplete-light, I'm beginning to figure what users expect and the common mistakes, like registering the wrong model for autocomplete, or having troubbles figuring how to link suggestions with other form fields, or create choices on the fly, or with the magic modelform. So at first, I really tried to find other autocompletion apps for with DAL could be just an extension. It turned out that with they had too much security issues, known security vulnerabilities which aren't going to be fixed (which I don't dare to post here). Read More

Syntax highlighting for Django’s SQL query logging

| by jpic | python django
Markus Holtermann has published a tutorial for setting up syntax highlighting for Django's SQL query logging. I didn't try it but it looks pretty cool, maybe that's something we could add to django-dbdiff somehow. Anyway, check it out !

django-autocomplete-light 2.3.3 release

| by jpic | python django django-autocomplete-light
This release fixes an important usability but on the manychoice fields, and introduces a minor backward compatibility break: #563 Don't disable multiplechoicewidgets if select is [multiple], bd9ca0085 Don't import anything in init anymore if on django 1.9 test_project fixes, for the above. Disabled field bug Thanks George Tantiras for reporting the bug ! Note that only paliative solutions have been taken for v2: repaired the demo website, should make it easier to spot bugs, bug fix in the JS. Read More

Automatic fixtures for HTTP Response assertions

| by jpic | python django test django-responsediff best-practice
As stated in the “Database state assertion” article: I'm pretty lazy when it comes to writing tests for existing code, however, I'm even lazier when it comes to repetitive manual testing action. When my user tests my website, they browse it and check that everything is rendered fine. In the same fashion, django-responsediff eases doing the high-level assertions of page HTML rendering. Consider this example: class TestYourView(TestCase): def test_your_page(self): result = test. Read More

django-autocomplete-light 2.3.0 release

| by jpic | python django django-autocomplete-light
#555 Django 1.4, 1.5 and 1.6 deprecation #497 Enable registration by model-name by @luzfcb #536 #551 Support proxy models b y @onrik #553 improved jQuery integration by @blueyed #516 Corrected french transation by @apinsard #541 Use error_messages on FieldBase to allow overrides by @dsanders11 #505 Ordering alias clash fix by @sandroden #515 Polish translation update by @mpasternak #543 ModelChoiceField requires the queryset argument #494 ModelChoiceField Watch changes to ‘queryset’ by @jonashaag #514 Fixed deprecation warning on Django 1. Read More

Django database testing

| by jpic | python django django-dbdiff
I'm pretty lazy when it comes to writing tests for existing code, however, I'm even lazier when it comes to repetitive manual testing action, we've got so much patches to review and test against so many versions of Python and Django, we need testing to be automated. This article presents a new Django app for testing the database. Java has DBunit and so does PHP, and django now has django-dbdiff. Read More

django-cities-light 3.2.0 release

| by jpic | python django django-cities-light
django-cities-light 3.2.0 was released, supporting Django 1.7 to 1.9 now, even though older versions should still work, they aren't tested anymore. #105: Drop LazyProgressBar, patch was accepted upstream by Max Arnold, #104: Better feature code filtering by Max Arnold and Michael Gulev, #100, #96: The mystery about migrations appearing in some environments but not others has been solved: it was due to the presence of b'' in migration files. A new test was added to fail if django wants to create new migrations in any environment. Read More

django-session-security 2.3.x releases

| by jpic | django python django-session-security
Starting 2.3.0, django-session-security supports Django 1.7 to Django 1.10 with tox. In 2.3.1, Andrei Coman added redirectTo parameter and tests were stabilized using django-sbo-selenium and tox.

Django 1.9 support for Django-autocomplete-light

| by jpic | python django django-autocomplete-light
Since Django 1.9a1 was released, many users are going to upgrade their project and wonder why django-autocomplete-light won't load anymore. Probably, some users are going to google ImportError or even django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet about autocomplete_light and Django 1.9. This post documents the situation and provides a solution. Do: find test/ -name foo -exec sed -i 's/import autocomplete_light/from autocomplete_light import shortcuts as autocomplete_light/' '{}' \; I don't remember why exactly since we've baked Django 1. Read More

django-autocomplete-light 2.2.0 release

| by jpic | python django django-autocomplete-light
After 8 release candidates, we've got our new shining 2.2.0 release of django-autocomplete-light which literally drown the backlog, we're down to less than one github page of issues now. Needless to say, we've closed an insane amount of issues with 2.2.0. Please read the release notes before upgrading.

django-autocomplete-light 2.2.0rc1 release notes

| by jpic | django-autocomplete-light django python
This article presents the changelog for django-autocomplete-light 2.2.0 release. To upgrade to 2.2.0rc1: pip install -U --pre django-autocomplete-light If you find any problem, please report it on github issues and downgrade to last stable (2.1.x series): pip install -U django-autocomplete-light Pending break warning, Django >= 1.9 The good old import autocomplete_light API support will be dropped with Django 1.9. All imports have moved to autocomplete_light.shortcuts and importing autocomplete_light will work until the project is used with Django 1. Read More

Scripted Cache AnyThing - HTTPS included - in Python with mitmproxy

| by jpic | linux python security ci
The last article demonstrated how we could simply make any https flow going out a virtual bridge network interface through mitmproxy to cache anything. In this article, we'll focus on the logic to “cache anything” from within our mitmproxy script. Design We'd like each fetched file to be stored in a directory as is to make it easy to tweak the cached content: remove a file from the cache directory to force the proxy to re-fetch it, fill the cache directory with your own files, have the cache directory mountable in a memory (ie. Read More

Scripted MITM AnyThing in Python with mitmproxy

| by jpic | linux python security ci
This article describes how to get a working transparent HTTP/HTTPS proxy which you can script in Python. I intend to use it to have custom caching and be able to abstract away all HTTP/HTTPS connections made in my LXC containers which are spawned by CI to be able to test deployment scripts even when internet is down. A nice journey ;) First, install mitmproxy with pip: pip install mitmproxy mitmproxy documentation describes the iptables commands to intercept Assuming you have LXC with Nat. Read More

django-cities-light 3.1.0 release

| by jpic | django-cities-light django python
Pluggable models have come to django-cities-light thanks to Alexey Evseev. It's completely backward compatible and allows you swap default models with your own as well as connecting to new signals the geonames import command. On the behalf of YourLabs, I'd like to welcome Alexey Evseev aboard ! I recommend hiring with Alexey Evseev if you have the chance and trust in with your mission. Upgrade instructions: pip install -U django-cities-light Don't forget to read how to customize your models with django-cities-light it's ultra simple. Read More

Speed up your travis-ci builds with container based infrastructure

| by jpic | travis-ci python django linux
Travis-ci just released container based infrastructure for open source repository (free users). We tried it with our apps, and you can see we had some performance increase, even on database-intensive jobs: django-autocomplete-light normal build takes around 1 hour and 35 minutes while it takes rather 1 hour and 22 minutes with container based build](https://travis-ci.org/yourlabs/django-autocomplete-light/builds/45086517) so that's around a 10% build speed increase, pretty cool right ? read on ;) django-cities-light normal build takes around 5 hours and 45 minutes, on travis-container it takes around 3 hours and 30 minutes ! Read More

yawd-admin: brilliant django admin responsive theme

| by jpic | python django
Check out yawd-admin for Django, it's responsive and beautiful !

Django 1.7 Release !

| by jpic | django python
Django 1.7 final has been released, and it's awesome, check it out !

django-cities-light 2.3.1 released

| by jpic | django python django-cities-light
django-cities-light 2.3.1 was released: #42 added FAQ: Some data fail to import or don't import like I want, how to skip them ? #45 django-rest-framework support update by @almalki. #49 Added country_items_pre_import and region_items_pre_import by @mauricioabreu. #51 Slug should be used in unique_together along with name. #51 Skip duplicate cities with no regions #52 Added FAQ on MySQL and UTF-8 #53 Country phone prefix support by @csarcom Forms update. It is backward compatible and has migrations: don't forget to run: Read More

Django 1.7 new feature: AppConfig

| by jpic | django python
Check out the new applications documentation for Django 1.7 ! It's still quite cryptic what will “holding app metadata” be really able to do. For starters it enables changing the name of an app in the admin without any hack. It will probably make installing and customizing apps easier, ie.: provides a default setting system, similar to django-appconf, automatically include app-specific stuff like middlewares, urls, etc, etc … ? replace an app's model ? Read More

RuntimeError: Failed to shutdown the live test server in 2 seconds. The server might be stuck or generating a slow response.

| by jpic | selenium python django travis-ci
Another problem you might run into when testing Django apps with Selenium on Travis: ====================================================================== ERROR: tearDownClass (autocomplete_light.tests.widget.WidgetTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/travis/build/yourlabs/django-autocomplete-light/autocomplete_light/tests/widget.py", line 29, in tearDownClass super(WidgetTestCase, cls).tearDownClass() File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/django/test/testcases.py", line 1148, in tearDownClass cls.server_thread.join() File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/django/test/testcases.py", line 1072, in join self.httpd.shutdown() File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/django/test/testcases.py", line 959, in shutdown "Failed to shutdown the live test server in 2 seconds. The " RuntimeError: Failed to shutdown the live test server in 2 seconds. Read More

Interresting Python and pip behaviour with Python 2 and 3 compatible packages

| by jpic | python selenium pip
In this article we'll explore a gotcha with Python 2 and 3 support on the long run, using Selenium as an example. Selenium is an automated testing tool enabling the tests to control a temporary browser GUI - Firefox by default. You can use it to automate functional testing. Selenium 2.37 had Python 2 and 3 support. But a little before the 2.38 release, some non-Python3-compatible code was commited. This was released in selenium 2. Read More

Django 1.5.4 security release

| by jpic | django python
Django 1.5.4 security release is out. It limits password lengths so that people don't upload 1Mb passwords (limit for nginx default config). Imagine 1000*1Mb to hash ? That could potentially cause a DoS. Update your django installs.

Using bootstrap and less css in django

| by jpic | python django git
Overview Compile less in debug mode in the browser for development. This enables your integrator to work faster and to view syntax errors reports in the browser and make development awesome. Use django-compressor for production to pre-compile all your less into css and make performance awesome. Be able to reuse in your less scripts: bootstrap classes, variables, etc, etc … else what is less good for ? The problem is that you must get your compiler to compile both bootstrap and your own less scripts in the same run. Read More

Automatic updates for commits made with GitHub code editor

| by jpic | python django github
For development, we host the project on some small server. It is running via ./manage.py runserver just for our customer to be able to see what's going on. Also, this enables our designer to hack the project via SFTP without having to deploy the website locally. Currently we are working with a new designer who found out that GitHub's editor was pretty cool because it saves him from doing backups himself. Read More

New cool django-admin themes

| by jpic | python django
django-responsive-admin and django-suit are interesting new themes for Django admin.

Django 1.7 might have schema alteration super powers

| by jpic | python django
Andrew Godwin, Django core dev and author of django-south, submitted a pull request for django to include schema migration features.

Partition your data with django-parting

| by jpic | django python
Just stumbled on django-parting which provides a nice API to partition your data. For those not familiar with data partitioning, I recommend reading partitionning on mysql.

PyCon 2013 videos are online !

| by jpic | python
Check them out.

Enable global site packages in an existing virtualenv

| by jpic | python virtualenv
Nowadays, virtualenv uses --no-site-packages by default. This means that the created virtualenv will not access global site-packages modules ie. /usr/lib/python2.7/site-packages/. To enable global site-packages again, just remove this file:: your_env/lib/python2.7/no-global-site-packages.txt Why would you do that ? Some modules are complicated to install (xpyb) or take too much time to compile (pyqt). Using the distro packages can be pretty useful !

There's no magic: virtualenv for beginners

| by jpic | python
Allison from hacker school published an interesting article about virtualenv for beginners.

Jedi-vim/rope takes too long

| by jpic | python vim
For those using jedi-vim are indirectly using rope refactoring library. If you are also using a home-level virtualenv ie. in ~/env/ then your vim instance might take crazy long time. First things first, rope creates a .ropeproject directory where it thinks the project root is. And it will scan every file in every sub directory. A quick and dirty solution is to create empty .ropeproject folders lower in the $HOME filesystem. Read More

Playlistnow.fm source code is now open !

| by jpic | django python
Playlistnow.fm is a social network based on music made in Python/Django. The catalog is powered by last.fm and the videos come from youtube. Before its final death, we decided to release the source code under Apache 2.0 license.

Using Ghost.py to test Django applications with LiveServerTestCase

| by jpic | django python best-practice
I'm posting this because it took me quite a few hours to get to this point: Ghost.py seem to have a nicer API and to be faster than selenium so far.

django-smarter: the CRUD app I've been waiting for

| by jpic | django python
django-smarter looks way cool, check it out !

Fantastic python code auto-complete: jedi

| by jpic | vim python
It's been a few days since I'm using jedi auto complete for vim, but for now all I can say is that it's highly recommendable. It's not perfect of course, particularly when it comes to autocompleting self., but still, it's a great addition to python-mode.

Using rst for documentation on both GitHub and Sphinx/RTFD: code-block tip

| by jpic | python documentation service
Good documentation should be readable from source, and usable to generate fancy HTML. That's why RST is so commonly used: readable as text source, usable to generate HTML and even PDF GitHub knows how to render it, Sphinx and ReadTheDocs know how to render it. Good documentation should often show code. This article demonstrates an inconsistency between RTFD and GitHub rendering, and how to fix it. As far as sphinx is concerned, the default highlight language for code blocks is Python. Read More

PythonAnywhere: free and awesome Django web host

| by jpic | python service
Here's a really cool contribution. Harry Percival emailed django-developers about his employer, PythonAnywhere: We do offer Django hosting as part of our Free plan, so it's a nice place for people to come and try out Django, for free, maybe host a prototype web app… I registered to give it a tried and received an amazing welcome email, which I won't spoil for you !

Testing django signals properly

| by jpic | python django
Asserting that signals were sent properly can be a bit tricky: they must be sent in a particular order with specific arguments. Fortunately, mock-django provides plenty of cool features, including a nice signal receiver mock. The only problem with mock-django is that it's not documented. So I had to reverse-engineer and here's what I've found: the best way to test a signal is to use the call_args_list property of the receiver mock. Read More

Design patterns in Python

| by jpic | best-practice python
I just came across this fantastic repo, which contains many design pattern implementations in Python. My advice: read them all :)

django-autocomplete-light-1017-released

| by jpic | django python
Django-autocomplete-light 1.0.17 released !

Never hardcode absolute paths

| by jpic | python django best-practice
This is nonono: STATIC_ROOT = '/home/coat/www/site/app/static/' Never hardcode absolute paths, you're just making your settings file less portable and probably killing kittens. Adapt this to your needs: import os.path import posixpath PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..') STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') # fix STATICFILES_DIRS too # and TEMPLATE_DIRS

How to see exception stacktraces with django LiveServerTestCase

| by jpic | django python
After playing with selenium and LiveServerTestCase a little while, you might see this: Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "/home/jpic/env/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 68, in __call__ return super(StaticFilesHandler, self).__call__(environ, start_response) File "/home/jpic/env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 241, in __call__ response = self.get_response(request) File "/home/jpic/env/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in get_response return super(StaticFilesHandler, self).get_response(request) File "/home/jpic/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 153, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/home/jpic/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 228, in handle_uncaught_exception return callback(request, **param_dict) File "/home/jpic/env/local/lib/python2. Read More

Free services you can use to make a great python app

| by jpic | python
A great django app should have: a source repository an issue tracker documentation release packages a mailing list continuous integration translations Source code repository and issue tracker Usually, source code repository services come with an issue tracker. The most common are Github and Bitbucket for mercurial. You can find other git hosts such as Baregit but they don't necessarily include an issue tracker like Github or Bitbucket. Most django apps use github, but also many of them are on bitbucket. Read More

Automatic virtualenv activation

| by jpic | virtualenv python
This article proposes a proven standard which enables automatic virtualenv activation. Demonstration Before, I had to do something like: cd myproject source ../env/bin/activate Now I just do: cd myproject Virtualenv standard Say I have a project called projectX, you could expect to find it as such on my servers: /srv /projectX_prod /projectX_test /projectX_dev /projectX_dev_env -> the virtualenv /env -> symlink to projectX_dev_env /main -> the checkout of the python project As you can see, it is easy and consistent. Read More

Distro-agnostic craftman’s guide to python environment management

| by jpic | linux python
This article demystifies deployment of Python applications on any unix flavor. It’s distro agnostic approach is possible by a pragmatic use of each layer of a standard python application. This article targets system administrators and why not python developers as well? Crafting python Compiling Python is blazingly easy and fast, particularly for veteran php system administrators ! First things first, to see the compile flags of an existing python installation, the “sysconfig” module can be used: Read More

How to override a view from an external Django app

| by jpic | django python best-practice
This article describes how to override a view from an external Django app which is a FAQ on StackOverflow and IRC. You should understand that your urls.py is a really central and critical part of your django project. You don't touch external app code You are not supposed to edit the code from an external app. Unless you fork it first on github. How to override without forking Overriding a template If you want to override templates/userena/activate_fail. Read More

Django, Pinax, virtualenv, setuptools, pip, easy_install and requirements.txt

| by jpic | django pinax python virtualenv best-practice
This article describes how to build project dependencies with virtualenv. It is appliable to Pinax. Pinax uses virtualenv by default. It lets the developer have a project-specific python directory, including binaries, packages etc … OpenSuse for example supplies very bad Pinax packages which allows the user to mess with his operating system. It is much better to isolate project dependencies from a project to another for more granular control of the maintenance cost; for example if a package upgrade breaks the user project. Read More
1 of 16 Next Page