Skip to content

Instantly share code, notes, and snippets.

View Hassanzadeh-sd's full-sized avatar
♻️
#SOReady2Help

Sajjad hassanzadeh Hassanzadeh-sd

♻️
#SOReady2Help
View GitHub Profile
@Hassanzadeh-sd
Hassanzadeh-sd / gist:91b8523e412bcde849ce3a8e77bc0031
Last active March 8, 2022 09:39
backup from all migrations to zip files Usage: ./zip_migrations.sh app1 app2 app3 app4
set -o errexit
set -o pipefail
set -o nounset
working_dir="$(dirname ${0})"
GREEN='\033[01;32m'
echo -e "\e[37mINFO\e[0m: createing migration archives ..."
for f in "$@"
from django.db import connection, reset_queries
import time
import functools
def query_debugger(func):
@functools.wraps(func)
def inner_func(*args, **kwargs):
reset_queries()
version: "3.7"
volumes:
psql_data:
networks:
wize_project:
services:
web:
@Hassanzadeh-sd
Hassanzadeh-sd / .drone.yml
Created May 9, 2020 19:45
django lint and test drone yaml file
kind: pipeline
name: wize_project_ci
type: docker
platform:
os: linux
arch: amd64
workspace:
path: /drone/app
# hassanzadeh.sd@gmail.com
version: "3.7"
services:
drone-server:
image: drone/drone:1
container_name: drone-server
ports:
- 4021:80
@Hassanzadeh-sd
Hassanzadeh-sd / DockerFile_install_pyodbc
Created April 14, 2020 17:49
solved install pyodbc problem in docker
FROM wize/python-service:latest
RUN apt-get update && \
apt-get install -y unixodbc-dev && \
apt-get install -y unixodbc-bin && \
apt-get install -y unixodbc-dev
@Hassanzadeh-sd
Hassanzadeh-sd / docker-compose.yml
Last active April 5, 2020 12:10
MySQL and PhpMyAdmin docker-compose file
version : '3'
services:
mysql:
image: mysql:latest
container_name: dev_mysql
environment:
MYSQL_USER: wize
MYSQL_PASSWORD: 987654321
MYSQL_ROOT_PASSWORD: 123456789
MIDDLEWARE = [
'app.custommiddleware.ProcessViewNoneMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
from datetime import datetime
class BaseMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
return self.get_response(request)
class ProcessViewNoneMiddleware(BaseMiddleware):
from django.contrib import admin
from django.urls import path
from app.views import Home
urlpatterns = [
path('admin/', admin.site.urls),
path('', Home)
]