安装python3请查看
python3.X安装http://blog.csdn.net/anshichuxuezhe/article/details/78724027
安装django
pip3 install django
django-admin
运行django-admin不报错就说明安装成功了
新建一个django项目
cd /
mkdir djangotest
cd djangotest
django-admin.py startproject demosite
cd /djangotest/demosite/demosite
vi settings.py
修改 ALLOWED_HOSTS = ['192.168.1.101', 'localhost', '127.0.0.1']
:wq
cd /djangotest/demosite
python3 manage.py runserver 0.0.0.0:8000
这时候访问浏览器
http://localhost:8000
能访问成功就说明项目启动了
我首次安装出现问题:
1、没有sqlite3,解决方案
pip3 install pymysql
cd /djangotest/demosite/demosite
vi settings.py
把 DATABASES=...这几行注释掉
:wq
cd cd /djangotest/demosite
python3 manage.py runserver 0.0.0.0:8000
2、遇到mysqlclient 1.3.3 or newer is required; you have 0.7…这个错误,解决方案
cd /usr/local/lib/python3.6/site-packages/django/db/backends/mysql
把 if version < (1, 3, 3):这两行注释掉
:wq
cd cd /djangotest/demosite
python3 manage.py runserver 0.0.0.0:8000
这时候终于运行成功了