Django3 的服务器搭建
进入python虚拟环境 执行以下 命令
source env/bin/active 激活并切换虚拟环境
安装
pip3 install django
创建django项目
django-admin startproject 项目名称
报错:bash: django-admin: command not found...
- 解决:
python3 /usr/local/python3/lib/python3.7/site- packages/django/bin/django-admin.py startproject mypro
cd 项目中 接着
python manage.py startapp 子应用名称
- 报错 :找不到sqlite
- 解决步骤:
① yum -y install sqlite-devel ② 切换到Python-3.7.4 ③ 执行:./configure --prefix=/usr/local/python3 ④ make ⑤ 如果没有权限:sudo make install // 有权限:make install
python manage.py startapp 子应用名称
- 报错:sqlite版本问题
- 解决步骤:
cd ~ wget https://www.sqlite.org/2019/sqlite-autoconf-3270200.tar.gz tar -zxvf sqlite-autoconf-3270200.tar.gz cd sqlite-autoconf-3270200./configure --prefix=/usr/local make make install find /usr/ -name sqlite3
cd ~ ls 删除没有用的文件 rm -rf sqlite-autoconf-3270200.tar.gz rm -rf sqlite-autoconf-3270200 更改旧的sqlite3 mv /usr/bin/sqlite3 /usr/bin/sqlite3_old 软链接将新的sqlite3设置到/usr/bin目录下 ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite3 将路径传递给共享库 export LD_LIBRARY_PATH="/usr/local/lib" 查看sqlite3有没有更新成功: python3 import sqlite3 sqlite3.sqlite_version 3.27.1
- 启动django
cd 项目 python3 manage.py runserver 启动django服务
- 退出虚拟环境
deactivate
相关推荐
dearm 2020-08-25
loveandroid0 2020-06-08
loveandroid0 2020-05-31
Attend 2020-05-27
huacuilaifa 2020-05-27
MFCJCK 2020-05-16
ggwxk0 2020-05-07
MFCJCK 2020-05-05
仁鱼 2020-03-26
huavhuahua 2020-03-03
DAV数据库 2020-03-03
MFCJCK 2020-01-11
Dlanguage 2020-01-03
loveandroid0 2019-12-30
wzxxtt0 2019-12-29
宿舍 2019-11-30
昭君出塞 2011-03-27
fuzhangpeng 2011-08-09
踩风火轮的乌龟 2008-03-22