首页 > 其他 > 详细

Django 1.8安装使用

时间:2015-07-25 13:35:52      阅读:297      评论:0      收藏:0      [点我收藏+]

1、使用pip安装django, pip是什么,如何安装?自行放狗搜

# pip install "django<1.9"

2、创建项目

# django-admin startproject djangosite

3、运行项目

# cd djangosite

# python manage.py runserver 10.211.55.21:91

运行过程中如果报错
django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3

请依次安装,安装下面两个包之后,就可以运行了

# yum install sqlite-devel

# pip install pysqlite

# 启动django程序后,如果提示如下警告

You have unapplied migrations; your app may not work properly until they are applied.
Run ‘python manage.py migrate‘ to apply them.

很明显,已经告诉我们怎么做了,那就执行一下:python manage.py migrate
话说这个migrate是干什么的呢,它可以让我们在修改Model后可以在不影响现有数据的前提下重建表结构。

(或者在settings.py里加上这么一句:TEST_RUNNER = ‘django.test.runner.DiscoverRunner‘)

现在在运行一次,应该不会有什么问题了

[root@localhost djangosite]# python manage.py runserver 10.211.55.21:9100
Performing system checks...

System check identified no issues (0 silenced).
July 25, 2015 - 04:40:43
Django version 1.8.3, using settings ‘djangosite.settings‘
Starting development server at http://10.211.55.21:9100/
Quit the server with CONTROL-C.

Django 1.8安装使用

原文:http://www.cnblogs.com/weiok/p/4675667.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!