Django 使用mariadb

  1. 修改settings
DATABASES = {
'default': {
     'ENGINE': 'django.db.backends.mysql',
     'NAME': '数据库名字',
     'USER': '数据库用户',
     'PASSWORD': '数据库密码',
     'HOST': '127.0.0.1',
     'PORT': '3306',
     'OPTIONS': {
         'charset' : 'utf8',
         'use_unicode' : True,
#        'autocommit': True,
          }
}
}
2. 修改__init__.py
import pymysql
pymysql.install_as_MySQLdb()

ubuntu22.04 源

阿里源

 

deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

 

中科大源

 

deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse

 

网易 163 源

 

deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse

Conda操作命令

  1. 删除环境

    conda remove -n your_env_name –all

  2. 创建环境

    conda create -n your_env_name pytohn==3.6

  3. 退出环境

    source deactivate your_env_name

  4. 激活环境

    source activate  your_env_name

  5. 列出所有的环境

    conda info –envs

  6. 取消自动激活环境

    conda config –set auto_activate_base false

  7. 自动启动某个环节

    编辑 ~.bashrc

    只要在此文件末尾加一行就搞定

    conda activate your_envs # “your_envs”就是你的环境

  8. 添加国内conda 源

    conda config add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free    

    conda config add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

    conda config set show_channel_urls yes