This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
rabbitmq: | |
image: "rabbitmq:alpine" | |
expose: | |
- "5672" | |
postgres: | |
image: "postgres:alpine" | |
expose: | |
- "5432" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AjaxUpdateTemplateViewMixin(object): | |
update_block = 'ajax_content' | |
def render_to_response(self, context, **response_kwargs): | |
""" | |
:type self: django.view.generic.TemplateView | |
""" | |
if self.request.is_ajax(): | |
response = TemplateResponse( | |
request=self.request, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>4WayFS series renderer</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def profile(func): | |
"""Decorator for run function profile""" | |
import cProfile | |
import gprof2dot | |
import os | |
def wrapper(*args, **kwargs): | |
profile_filename = func.__name__ + '.prof' | |
profiler = cProfile.Profile() | |
result = profiler.runcall(func, *args, **kwargs) | |
profiler.dump_stats(profile_filename) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import pydevd | |
pydevd.settrace() | |
except: | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.Enter db shell: | |
# sudo -u postgres psql | |
2.Cheate user and owned database: | |
CREATE USER some_db_user WITH PASSWORD 'db_users_password'; | |
CREATE DATABASE some_db WITH OWNER some_db_user; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make a virtualenv: | |
$ virtualenv project_dir/virtualenv --no-site-packages | |
Activate the vitrualenv: | |
$ source project_dir/virtualenv/bin/activate | |
Install something: | |
$ project_dir/virtualenv/bin/pip install Some_package | |
Save requirements: |