Nov 7, 2011
Forms apps, snippets, widgets
django-forms-ext
Fields- ForeignKeyChoiceField - When you have a formset that has a foreign key, Django will fire off a new (identical) query to build the choices for that field for each form in the formset by default. Using this field will allow you to run the query once for the choices and re-use that queryset for each form in the formset. CommaSeparatedField - Django has a comma separated integer field, but not just strings. Stupid, I know... we created one for use with strings
- QuerysetChoiceField - When you want to build a select box with a queryset but don't want a model instance when saving, use this thing.
Views
- FormSetView - Django 1.3's generic views do not include a FormSet view. That's what this is.
django-stdfields
Fields
- MinutesField: use an integer to represent a duration of minutes and hours
- EnumIntegerField: makes working with choices a bit easier
- EnumCharField: the same, but for choices with a char key
django-forms-builder
A Django reusable app providing the ability for admin users to create their own formsdjango-bfm
- Multifile Uploads (Open File Dialog)
- Live Upload Status report (Upload applet)
- File browsing
- Directory support
- Core features has no dependencies (except for Django), lightweight
- Looks like django admin (extends admin template)
django-custom-field
django-wizard
allows views to be organized into steps for linear page flowsdjango-easyfilters
http://pypi.python.org/pypi/django-easyfilters/ - Easy creation of link-based filtering for a list of Django model objects.
Nov 3, 2011
Nov 2, 2011
Snippets, schemas
Schema.org - This site provides a collection of schemas, i.e., html tags, that webmasters can use to markup their pages in ways recognized by major search providers. Search engines including Bing, Google and Yahoo! rely on this markup to improve the display of search results, making it easier for people to find the right web pages.
Python / Django Performance profiling
https://code.djangoproject.com/wiki/ProfilingDjango
http://ianozsvald.com/2012/03/18/high-performance-python-1-from-pycon-2012-slides-video-src/
Профилирование и отладка Python, инструменты
django-processinfo - application to collect information about the running server processes.
runsnakerun - is a small GUI utility that allows you to view (Python) cProfile or Profile profiler dumps in a sortable GUI view. It allows you to explore the profiler information using a "square map" visualization or sortable tables of data. It also (experimentally) allows you to view the output of the Meliae "memory analysis" tool using the same basic visualisations.
dis - The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode.h and used by the compiler and the interpreter.
plop - Plop is a stack-sampling profiler for Python. Profile collection can be turned on and off in a live process with minimal performance impact.
statprof.py - This package provides a simple statistical profiler for Python.
pytrace - is a fast python tracer. it records function calls, arguments and return values. can be used for debugging and profiling.
http://ianozsvald.com/2012/03/18/high-performance-python-1-from-pycon-2012-slides-video-src/
Профилирование и отладка Python, инструменты
Django
django-extensions - this is a repository for collecting global custom management extensions for the Django Frameworkpython manage.py runprofileserver --use-cprofile --prof-path=/tmp/output
django-perftools
- QueryCountLoggingMiddleware - Perftools includes a logger that will monitor requests execution time. Once it hits the defined threshold, it will log to the named perftools logger, including the metadata for the request (as defined by Sentry's logging spec).
- RemoteProfilingMiddleware - Profiles a request and saves the results to disk.
- SlowRequestLoggingMiddleware - Logs requests which exceed a maximum number of queries.
from profiling import profile
@profile
def complex_computations():
#some complex computations
django-processinfo - application to collect information about the running server processes.
dogslow - Dogslow is a Django watchdog middleware class that logs tracebacks of slow requests.
Python
line_profiler - is a module for doing line-by-line profiling of functions. kernprof is a convenient script for running either line_profiler or the Python standard library's cProfile or profile modules, depending on what is available.runsnakerun - is a small GUI utility that allows you to view (Python) cProfile or Profile profiler dumps in a sortable GUI view. It allows you to explore the profiler information using a "square map" visualization or sortable tables of data. It also (experimentally) allows you to view the output of the Meliae "memory analysis" tool using the same basic visualisations.
dis - The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode.h and used by the compiler and the interpreter.
def myfunc(alist):
return len(alist)
>>> dis.dis(myfunc)
2 0 LOAD_GLOBAL 0 (len)
3 LOAD_FAST 0 (alist)
6 CALL_FUNCTION 1
9 RETURN_VALUE
plop - Plop is a stack-sampling profiler for Python. Profile collection can be turned on and off in a live process with minimal performance impact.
statprof.py - This package provides a simple statistical profiler for Python.
pytrace - is a fast python tracer. it records function calls, arguments and return values. can be used for debugging and profiling.
WSGI
wsgi-shell - The 'ispyd' package provides an in process shell for introspecting a running process. It was primarily intended for investigating running WSGI application processes, specifically to determine what a process is doing when it hangs, but has many other features as well. This includes being able to start an embedded interactive Python interpreter session, set debugger probe points to record tracebacks for exceptions and then later run 'pdb' in post mortem mode on those exceptions.Linux
top -H
1 - нагруженность цпу
С - сортировать по цпу
М - сортировать по памяти
к - прибить процесс
с - показать путь к комманде
vmstat - выдает информационный отчет о активности процессов, памяти, свопинга, поблочного ввода/вывода, прерываний и процессора
w - кто зарегистрирован и что они делает
free – использование памяти
pstree - процессы в виде иерархии
ps
ps -u someusername -o pid,%cpu,%mem,start_time,size=-size-,state,cmd
ps -u someusername -o pid,%cpu,%mem,start_time,size=-size-,state,comm | grep runfastcgi.fcgi
Disks usage
df -h
1 - нагруженность цпу
С - сортировать по цпу
М - сортировать по памяти
к - прибить процесс
с - показать путь к комманде
vmstat - выдает информационный отчет о активности процессов, памяти, свопинга, поблочного ввода/вывода, прерываний и процессора
w - кто зарегистрирован и что они делает
free – использование памяти
pstree - процессы в виде иерархии
ps
ps -u someusername -o pid,%cpu,%mem,start_time,size=-size-,state,cmd
ps -u someusername -o pid,%cpu,%mem,start_time,size=-size-,state,comm | grep runfastcgi.fcgi
df -h
Labels:
performance,
profiling
Nov 1, 2011
Images processing apps
django-imagekit
from django.db import models
from imagekit.models import ImageSpec
from imagekit.processors import resize, Adjust
class Photo(models.Model):
original_image = models.ImageField(upload_to='photos')
thumbnail = ImageSpec([Adjust(contrast=1.2, sharpness=1.1),
resize.Crop(50, 50)], image_field='original_image',
format='JPEG', quality=90)
Translation apps
django-linguo
from linguo.models import MultilingualModel
from linguo.managers import MultilingualManager
class Product(MultilingualModel):
name = models.CharField(max_length=255, verbose_name=_('name'))
description = models.TextField(verbose_name=_('description'))
price = models.FloatField(verbose_name=_('price'))
objects = MultilingualManager()
class Meta:
# name and description are translatable fields
translate = ('name', 'description')
Labels:
app,
translation
Subscribe to:
Posts (Atom)
