分类标签归档:django

解决树莓派找不到sqlite3 的问题


  • 问题描述

WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?

WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?

WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?

树莓派已经安装了sqlite3 ,但是用pyenv 安装完3.8.3 的python提示没有安装sq

Read more

django rest framework


1.安装

pip install djangorestframework
pip install markdown       # Markdown support for the browsable API.
pip install django-filter  # Filtering support
  • 修改settings 文件的INSTALLED_APPS
INSTALLED_APPS = [
    ...
    'rest_framework',
]
  • 添加路由
    urlpatterns = [
      ...
      url(r'^api-auth/',

Read more

鉴黄接口


1、服务端安装

把雅虎的鉴黄模型下载到服务器

git clone https://github.com/yahoo/open_nsfw.git
# 如果clone比较慢,可以直接下载zip包也行

2、构建Caffe Docker映像(CPU)

docker build -t caffe:cpu https://raw.githubusercontent.com/BVLC/caffe/master/docker/cpu/Dockerfile

3、进行鉴黄

cd open_nsfw
docker run --volume=$(pwd):/workspace caffe:cpu \
python

Read more

django rest framework 安装与使用


1、安装

pip install djangorestframework
pip install markdown       # Markdown support for the browsable API.
pip install django-filter

2、 添加rest_framework 到settings

INSTALLED_APPS = [
    ...
    'rest_framework',
]

3、样例

from django.contrib import admin
from django.urls import path, include
f

Read more

sentry 实时错误追踪系统配置与使用


1、汉化

2、选择时区和设置日期格式

3、创建完django项目后

安装sdk

pip install --upgrade 'sentry-sdk==0.14.3'

settings.py 设置如下

import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
    dsn="http://9b51bb0sdf5245147sdf0e9d1b7sdf891e4717b55@xxx.xxx.xxx.xxx:9000/2"

Read more

sentry 实时错误追踪系统部署


1、安装docker

参照 https://www.65535.fun/article/2020/4/14/48.html

2、sentry 安装

git clone https://github.com/getsentry/onpremise.git
cd onpremise
docker-compose build
./install.sh  # 这个安装过程要很久,最后会让你输入邮箱作为管理员账号以及密码

4、启动容器

docker-compose up -d
# 查看容器
docker-compose ps

5、浏览器访问

http://ip:9000

FAQ:

[root@g

Read more