Django笔记1_环境搭建
来源:互联网 发布:java selector 编辑:程序博客网 时间:2024/05/09 09:21
一、软件安装
</pre><p></p><p><span style="white-space:pre"></span>Python3.4.1+Django1.7.1+Mysql5.6</p><p><span style="white-space:pre"></span>1,安装Python3.4.1 ,不多说</p><p><span style="white-space:pre"></span>2.,dos窗口切换到python的安装目录下的Python34\Scripts 利用pip 安装Django </p><p><span style="white-space:pre"></span></p><pre name="code" class="plain"><span style="white-space:pre"></span>pip install django==1.7.1
2.安装mysql 不详细叙述
3安装MySQLdb 我是很久之前安装好的,具体怎么装的忘了,有几种思路,1.利用pip 或者easy_install.或者下载源码包,或者寻找msi文件但一定要对应好版本。
二环境配置
在任一目录下运行 python django-main.py startproject projectName 其中projectName是你的项目名称 或生产projectName的一个文件夹包含一个manage.py 文件和一个projectName同名的文件夹,里面包含__init__.py __settings.py__ __urls.py__ __wsgi.py__ 四个文件。
- manage.py: A command-line utility that lets you interact with this Django project in various ways. You can read all the details about manage.py in django-admin.py and manage.py.(很多明明)
- The inner mysite/ directory is the actual Python package for your project. Its name is the Python package name you’ll need to use to import anything inside it (e.g. mysite.urls).
- mysite/__init__.py: An empty file that tells Python that this directory should be considered a Python package. (Read more about packages in the official Python docs if you’re a Python beginner.)
- mysite/settings.py: Settings/configuration for this Django project. Django settings will tell you all about how settings work. (设置文件,包括数据库的设置都在里面)
- mysite/urls.py: The URL declarations for this Django project; a “table of contents” of your Django-powered site. You can read more about URLs in URL dispatcher.(指定url)
- mysite/wsgi.py: An entry-point for WSGI-compatible web servers to serve your project. See How to deploy with WSGI for more details.(有何用处体会不深)
__settings.py__ MySQL的配置
DATABASES = {
'default': {
'ENGINE':'django.db.backends.mysql',
'NAME':'pythondb',
'USER':'root',
'PASSWORD':'root',
'HOST':'127.0.0.1',
'PORT':'3306'
}
}
各个文件的说明 想系参考django1.7 的文档 如果你不是1.7 请更换对应版本,1.7和之前版本有区别的。
http://django-cn.readthedocs.org/zh_CN/1.7/intro/tutorial01.html
0 0
- Django笔记1_环境搭建
- django入门笔记1- 开发环境搭建
- django学习笔记(1)环境搭建
- Django学习笔记1-Eclipse Django开发环境搭建
- 【django 学习笔记】01-django环境搭建
- django-1:搭建django开发环境
- django学习笔记(一):环境搭建
- django(学习1)环境搭建
- django系列1:环境搭建
- Linux笔记(3)_环境搭建
- Django学习笔记(1)-环境
- django(1) 环境搭建及常用命令
- Django学习(1):环境搭建
- django基础入门(1)-搭建环境
- Django入门-搭建开发环境(1)
- Django入门 - 环境搭建
- Django 环境搭建
- Django环境搭建
- UI-UISwitch
- 使用数组的方法建立一颗二叉树
- liferay如何在struts2中調用ajax
- Linux下的两种服务:RPM包默认安装的服务和源码包安装的服务
- 2015年规划
- Django笔记1_环境搭建
- iOS开发资源
- sscanf高级用法总结
- VS2012安装后如何找到启动快捷方式
- Java自动探测文件的字符编码
- @RunWith(Parameterized.class)和@RunWith(SpringJUnit4ClassRunner.class)
- poj 1008 Maya Calendar
- 如何设置MyEclipse使项目构建速度加快--build workspace 卡住
- sql查询语句中like不能查出null字段的数据