标签:
1、安装python和pip(python、pip安装自行百度,pip是一个安装和管理 Python 包的工具)
2、配置python环境变量(python和scripts目录都需要配置)
3、安装Django :两种方法
安装:
第一种方法:在python\scripts目录下执行:pip install django
第二种方法:下载Django安装文件(如:Django-1.8.2.tar),解压,在cmd命令行进入Django-1.8.2所解压目录(注意解压目录下有setup.py文件),然后执行命令:python setup.py install
设置Django环境变量:
将Django安装目录设置添加到path下
验证是否安装成功:
D:\Django-1.8.2>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_version()
‘1.8.2‘
>>>
成功
4、安装django-bootstrap3
安装方法:
pip安装:在python\scripts目录下执行,pip install django-bootstrap3
手动安装:
下载:django-bootstrap3-7.0.1.tar.gz(下载地址:https://pypi.python.org/pypi/django-bootstrap3)
解压:
安装:cmd进入setup.py文件所在目录,运行命令:python setup.py install
D:\django-bootstrap3-7.0.1>python setup.py install
running install
running bdist_egg
running egg_info
......
Installed d:\python27\lib\site-packages\django_bootstrap3-7.0.1-py2.7.egg
Processing dependencies for django-bootstrap3==7.0.1
Finished processing dependencies for django-bootstrap3==7.0.1
安装完成后在Python27\Lib\site-packages目录下生成django_bootstrap3-7.0.1-py2.7.egg文件夹
在Django 的settings.py 文件中的INSTALLED_APPS 模块中添加“bootstrap3”,如下:
INSTALLED_APPS = (
‘django.contrib.admin‘,
‘django.contrib.auth‘,
‘django.contrib.contenttypes‘,
‘django.contrib.sessions‘,
‘django.contrib.messages‘,
‘django.contrib.staticfiles‘,
‘blog‘,
‘bootstrap3‘,
)
django-bootstrap3自带demo,进入demo目录,启动服务:
D:\django-bootstrap3-7.0.1\demo>python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are app
lied.
Run ‘python manage.py migrate‘ to apply them.
June 15, 2016 - 17:35:20
Django version 1.8.2, using settings ‘demo.settings‘
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
备注:D:\django-bootstrap3-7.0.1为解压目录
浏览器访问:http://localhost:8000/
标签: