One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| from functools import wraps | |
| class ViewDecorator(object): | |
| def __init__(self, decorator_class): | |
| self.decorator_class = decorator_class | |
| def __call__(self, *args, **kwargs): | |
| # Pretend that there is a generic decorator wrapper here | |
| pass |
| from django.utils.functional import wraps | |
| ... | |
| def check_company_admin(view): | |
| @wraps(view) | |
| def inner(request, slug, *args, **kwargs): | |
| # Get the company object | |
| company = get_object_or_404(Company, slug=slug) | |
| # Check and see if the logged in user is admin |
| You can easy do this by appearing custom attribute to model: | |
| class A(models.Model): | |
| _DATABASE = "X" | |
| class B(models.Model): | |
| _DATABASE = "X" | |
| ... |
UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth
on useless vacuuming of the table (since we never DELETE or UPDATE the table).COPY FROM STDIN. This is the fastest possible approach to insert rows into table.time timestamp with time zone is enough.synchronous_commit = off to postgresql.conf.VPS OVH | Ubuntu 16.04.3 LTS | LAMP | SYMFONY 4
git et hébergé (Github, Bitbucket...).