在CentOS7上部署Django的时候,遇到了一些问题,写篇笔记记录解决过程。

报错信息

python3 manage.py runserver启动django项目的时候,就会出现报错信息如下:
raise ImproperlyConfigured('SQLite 3.8.3 or later is required (found %s).' % Database.sqlite_version)
django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).

这是因为centos 默认的版本为3.7.17,并没有更新,我们只需要安装新的SQLite代替老版本就可以了。可以去搜索sqlite官网去下载源码。

查看系统的sqlte3的版本

1 [root@djangoServer work]# sqlite3 --version
2 3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
3 [root@djangoServer work]#

Centos7安装最新的sqlite3并设置更新python库版本

 1 #更新SQLite 3
2 #获取源代码(在主目录中运行)
3 [root@djangoServer ~]# cd ~
4 [root@djangoServer ~]# wget https://www.sqlite.org/2019/sqlite-autoconf-3270200.tar.gz
5 [root@djangoServer ~]# tar -zxvf sqlite-autoconf-3270200.tar.gz
6
7 #构建并安装
8 [root@djangoServer ~]# cd sqlite-autoconf-3270200
9 [root@djangoServer sqlite-autoconf-3270200]# ./configure --prefix=/usr/local
10 [root@djangoServer sqlite-autoconf-3270200]# make && make install
11 [root@djangoServer sqlite-autoconf-3270200]# find /usr/ -name sqlite3
12 /usr/bin/sqlite3
13 /usr/lib64/python2.7/sqlite3
14 /usr/local/bin/sqlite3
15 /usr/local/python3/lib/python3.7/site-packages/django/db/backends/sqlite3
16 /usr/local/python3/lib/python3.7/sqlite3
17 [root@djangoServer sqlite-autoconf-3270200]#
18
19 #不必要的文件,目录删除
20 [root@djangoServer sqlite-autoconf-3270200]# cd ~
21 [root@djangoServer ~]# ls
22 anaconda-ks.cfg sqlite-autoconf-3270200 sqlite-autoconf-3270200.tar.gz
23 [root@djangoServer ~]#
24 [root@djangoServer ~]# rm -rf sqlite-autoconf-3270200.tar.gz
25 [root@djangoServer ~]# rm -rf sqlite-autoconf-3270200
26
27 #检查版本
28 ## 最新安装的sqlite3版本
29 [root@djangoServer ~]# /usr/local/bin/sqlite3 --version
30 3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7
31 [root@djangoServer ~]#
32
33 ## Centos7自带的sqlite3版本
34 [root@djangoServer ~]# /usr/bin/sqlite3 --version
35 3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
36 [root@djangoServer ~]#
37
38 ## 可以看到sqlite3的版本还是旧版本,那么需要更新一下。
39 [root@djangoServer ~]# sqlite3 --version
40 3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
41 [root@djangoServer ~]#
42
43 ## 更改旧的sqlite3
44 [root@djangoServer ~]# mv /usr/bin/sqlite3 /usr/bin/sqlite3_old
45
46 ## 软链接将新的sqlite3设置到/usr/bin目录下
47 [root@djangoServer ~]# ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3
48
49 ## 查看当前全局sqlite3的版本
50 [root@djangoServer ~]# sqlite3 --version
51 3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7
52 [root@djangoServer ~]#
53
54 #将路径传递给共享库
55 # 设置开机自启动执行,可以将下面的export语句写入 ~/.bashrc 文件中,如果如果你想立即生效,可以执行source 〜/.bashrc 将在每次启动终端时执行
56 [root@djangoServer ~]# export LD_LIBRARY_PATH="/usr/local/lib"
57
58 #检查Python的SQLite3版本
59 [root@djangoServer ~]# ipython3
60 Python 3.6.8 (default, Aug 7 2019, 17:28:10)
61 [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
62 Type "help", "copyright", "credits" or "license" for more information.
63 >>> import sqlite3
64 >>> sqlite3.sqlite_version
65 '3.27.2'
66 >>> exit()
67 [root@djangoServer ~]#
68
69 #启动开发服务器
70 [root@djangoServer ~]# cd /work/
71 [root@djangoServer work]# ls
72 db.sqlite3 manage.py polls test_django
73 [root@djangoServer work]# python3 manage.py runserver
74 Watching for file changes with StatReloader
75 Performing system checks...
76
77 System check identified no issues (0 silenced).
78 May 03, 2019 - 21:32:28
79 Django version 2.2.1, using settings 'test_django.settings'
80 Starting development server at http://127.0.0.1:8000/
81 Quit the server with CONTROL-C.

解决 centerOS7部署ajango2.2.x版本 报SQLite 3.8.3 or later is required (found 3.7.17).错误的更多相关文章

  1. 解决IIS部署网站引用woff/woff2/svg字体报404错误

    一.问题 在IIS上部署网站,网页引用woff字体时,浏览器报“找不到woff.woff2字体”.“404”错误,不仅预设的字体加载不出来,还影响网页加载速度. 二.原因 IIS默认设置情况下不识别. ...

  2. webSphere 部署项目时,访问报错:Error 500: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet【我】

    前提: 一个普通maven项目,在本地用Tomcat运行没有任何问题,但是放到 webSphere  测试环境上,访问时就报如下错误: Error 500: javax.servlet.Servlet ...

  3. Spring Boot 项目本地运行无异常,部署到 Linux 服务器运行报错:java.lang.ClassNotFoundException

    一 背景 最近在用 Springboot 开发项目 A,引了小伙伴开发的模块 B,本地起服务,运行的好好的,等部署到服务器上,一运行就报错:Caused by: java.lang.ClassNotF ...

  4. jdk1.8+SpringAOP注解报java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut select错误的不知原因的解决办法[仅供参考]

    先说办法:如果Aspectweaver-1.*.*jar这三个包版本比较低, 比如1.5.0这一层次的,可以找版本高一点的包替换低版本的包,问题可以得到解决 jar包的下载地址:https://mvn ...

  5. 解决selenium不支持firefox低版本的问题

    解决selenium不支持firefox低版本的问题 在火狐浏览器升级后,突然发现webdriver运行脚本的时候不能调出火狐浏览器了,并报错WebDriverException:Message:'C ...

  6. 解决nextjs部署到now上之后出现的“Unable to import module 'now__launcher'”错误

    解决nextjs部署到now上之后出现的“Unable to import module 'now__launcher'”错误 这个错误是由于在next.config.js中直接引用了withLess ...

  7. Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法

    Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法原因:Scrapy需要的组 twisted 需要 C++环境编译. 方法一:根据错误提示去对应 ...

  8. 解决windows64位系统上安装mysql-python报错

    解决windows64位系统上安装mysql-python报错 2018年03月12日 13:08:24 一个CD包 阅读数:1231    版权声明:本文为博主原创文章,未经博主允许不得转载. ht ...

  9. 解决Firefox已阻止运行早期版本Adobe Flash

      解决Firefox已阻止运行早期版本Adobe Flash     类别    [随笔分类]web   解决Firefox已阻止运行早期版本Adobe Flash   最近火狐浏览器不知抽什么风, ...

随机推荐

  1. 如何打造高性能的 Go 缓存库

    转载请声明出处哦~,本篇文章发布于luozhiyun的博客:https://www.luozhiyun.com/archives/531 文中代码位置: https://github.com/devY ...

  2. 基于redis实现的四种常见的限流策略

    引言 在web开发中功能是基石,除了功能以外运维和防护就是重头菜了.因为在网站运行期间可能会因为突然的访问量导致业务异常.也有可能遭受别人恶意攻击 所以我们的接口需要对流量进行限制.俗称的QPS也是对 ...

  3. 【NX二次开发】Block UI 多行字符串

    属性说明 常规         类型 描述     BlockID     String 控件ID     Enable     Logical 是否可操作     Group     Logical ...

  4. 4.3CNN卷积神经网络最详细最容易理解--tensorflow源码MLP对比

    自己开发了一个股票智能分析软件,功能很强大,需要的点击下面的链接获取: https://www.cnblogs.com/bclshuai/p/11380657.html 1.1  CNN卷积神经网络 ...

  5. 【模拟7.27】单(liu_runda学长的神题)

    好像用到一些高中数学知识...... 满分做法: case 0:已知a数组求b数组 因为是树状结构,设当前节点x 儿子to 我们从任意一点出发可求出b[root]来,之后我们可以通过寻找两两相连节点的 ...

  6. 源码学习之noop

    /** * Perform no operation. * Stubbing args to make Flow happy without leaving useless transpiled co ...

  7. 万字长文详解HiveSQL执行计划

    Hive SQL的执行计划描述SQL实际执行的整体轮廓,通过执行计划能了解SQL程序在转换成相应计算引擎的执行逻辑,掌握了执行逻辑也就能更好地把握程序出现的瓶颈点,从而能够实现更有针对性的优化.此外还 ...

  8. Kubernetes网络的iptables模式和ipvs模式支持ping分析

    1.iptables模式无法ping通原因分析 iptables模式下,无法ping通任何svc,包括clusterip.所有ns下,下面来分析原因: 查看kubernetes的网络模式 curl 1 ...

  9. PING命令执行漏洞-绕过空格

    目录 PING命令执行漏洞-绕过空格 这边介绍一下绕过空格的方法大概有以下几种 方法一:用变量拼接:我们发现源码中有一个$a变量可以覆盖 方法二:过滤bash?那就用sh.sh的大部分脚本都可以在ba ...

  10. Java基础之(一)——从synchronized优化看Java锁概念

    一.悲观锁和乐观锁概念 悲观锁和乐观锁是一种广义的锁概念,Java中没有哪个Lock实现类就叫PessimisticLock或OptimisticLock,而是在数据并发情况下的两种不同处理策略. 针 ...