docker-compose 启动服务,需要用到脚本启动的情况
脚本的头部必须加上 #!/bin/bash
docker-compose
import os | |
import sys | |
import base64 | |
import json | |
from Crypto import Random | |
from Crypto.Cipher import AES | |
class AESCrypt: |
Had a similar problem with my reverse proxy. | |
This is the configuration that finally did it for me: | |
location / { | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forward-Proto http; |
import json | |
from json import JSONDecodeError | |
from logging.config import dictConfig | |
import requests | |
from flask import Flask, jsonify, request | |
from apps.forms import EventForm | |
from apps.tasks import collection_event_task | |
from apps.utils import (config_app, logger, cast_to_form_data, |
let path = "http://localhost:5000/api/export"; | |
axios | |
.get(path, { params: this.searchForm , responseType: 'blob'}) | |
.then(response => { | |
let data = response.data; | |
let fileName = res.headers['content-disposition'].match(/fushun(\S*)xls/)[0]; |
FROM python:3.6.5-slim | |
MAINTAINER shau-lok | |
RUN apt-get update \ | |
&& apt-get -yq install python-dev libmysqlclient-dev \ | |
libicu-dev apt-utils gcc curl wget vim \ | |
&& apt-get clean all | |
WORKDIR /app |
FROM python:3.6.5-slim | |
MAINTAINER shau-lok | |
RUN sed -i 's#http://archive.ubuntu.com#http://mirrors.163.com#g' /etc/apt/sources.list | |
RUN sed -i 's#http://deb.debian.org#http://mirrors.163.com#g' /etc/apt/sources.list | |
RUN sed -i 's#http://security-cdn.debian.org#http://mirrors.163.com#g' /etc/apt/sources.list | |
RUN sed -i 's#http://security.debian.org#http://mirrors.163.com#g' /etc/apt/sources.list | |
RUN apt-get update \ |
# Refers: https://github.com/requests/requests/issues/1604 | |
# 方法1: | |
r = requests.get('http://irresponsible-server/') | |
r.encoding = 'utf-8' | |
# 方法2: | |
r = requests.get('http://irresponsible-server/') | |
r.encoding = r.apparent_encoding |
from PIL import Image | |
import io | |
def load_image_from_bytes(image_data): | |
""" 从图片流中读取一张照片 """ | |
im = Image.open(io.BytesIO(image_data)) | |
print(im) | |
# >>> <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=300x240 at 0x102092B10> | |
// 前端做数据分页 | |
function pagination(pageNo, pageSize, array) { | |
var offset = (pageNo - 1) * pageSize; | |
return (offset + pageSize >= array.length) ? array.slice(offset, array.length) : array.slice(offset, offset + pageSize); | |
} | |
// 后端django做分页 | |
from django.core.paginator import Paginator |