Ubuntu の Python-Web框架Django 环境安装 V1.1
2016-06-10 17:42
731 查看
因为准备移植博客系统到自己的主机上,所以一直在考虑用什么环境,现在准备试试Django怎么样,于是我使用了这个Django框架来进行的,同样的,留下我的安装心得。Django需要安装Python 3.X的版本,而我这里目前是要求3.4.3,然后使用Pip安装,默认情况下Django是使用SQLLite,但是我准备用MySQL,所以就多了一个MySQL的安装,这里仅做一个初步的介绍,后续如果有进展,再跟进
Ubuntu の 多版本Python的安装管理与切换
Ubuntu の MySQL 数据库服务配置和远程连接使用教程
2、安装完服务以后,需要安装对应的mysql依赖
此处在V1.1时更新,增加缺失的依赖
Remove any old versions of Django¶
If you are upgrading your installation of Django from a previous
version, you will need to uninstall the old Django version before
installing the new version.
If you installed Django using pip or easy_install previously,
installing with pip or easy_install again will automatically take care
of the old version, so you don’t need to do it yourself.
If you previously installed Django using python setup.py install,
uninstalling is as simple as deleting the django directory from your
Python site-packages. To find the directory you need to remove, you
can run the following at your shell prompt (not the interactive Python
prompt):
$ python -c “import django; print(django.path)”
2、执行安装脚本
安装完成后我们验证一下是否安装成功就可以了,使用python引入DJango进行测试一下就可以了
以下代码是在Python环境中执行的,最后的1.9.7为输出,如果有这个输出,就代表成功了
Python 环境配置
这里需要的Python环境为3.4.3,Python的具体配置方法可以参照我的这篇博客,这里说的很清楚了Ubuntu の 多版本Python的安装管理与切换
MYSQL安装
1、这里我需要使用mysql,所以需要首先配置mysql,mysql的数据库安装可以参照这里,也是说的很详细了:Ubuntu の MySQL 数据库服务配置和远程连接使用教程
2、安装完服务以后,需要安装对应的mysql依赖
此处在V1.1时更新,增加缺失的依赖
sudo apt-get install mysql-client sudo apt-get install python3-dev libmysqlclient-dev pip install mysqlclient
移除旧版本Django
因为我没有安装过旧版本的DJango,所以并没有具体操作,这里直接留出最后结果来就好。Remove any old versions of Django¶
If you are upgrading your installation of Django from a previous
version, you will need to uninstall the old Django version before
installing the new version.
If you installed Django using pip or easy_install previously,
installing with pip or easy_install again will automatically take care
of the old version, so you don’t need to do it yourself.
If you previously installed Django using python setup.py install,
uninstalling is as simple as deleting the django directory from your
Python site-packages. To find the directory you need to remove, you
can run the following at your shell prompt (not the interactive Python
prompt):
$ python -c “import django; print(django.path)”
安装PIP
1、首先下载安装pip的脚本,记得自己先找好下载的地方wget https://bootstrap.pypa.io/get-pip.py
2、执行安装脚本
python get-pip.py
通过Pip安装DJango
使用PIP进行安装pip install Django
安装完成后我们验证一下是否安装成功就可以了,使用python引入DJango进行测试一下就可以了
以下代码是在Python环境中执行的,最后的1.9.7为输出,如果有这个输出,就代表成功了
>>> import django >>> print(django.get_version()) 1.9.7
参照
1、官方文档 我是参照官方文档来安装的,其实最简单的安装方式就是按照官方文档来,不容易出错。相关文章推荐
- Ubuntu 默认壁纸历代记
- Ubuntu Remix Cinnamon 20.04 评测:Ubuntu 与 Cinnamon 的完美融合
- 关于Ubuntu 11.10启动提示waiting for the network configuration的问题
- 在 Ubuntu 桌面中使用文件和文件夹
- Python动态类型的学习---引用的理解
- 从源码安装Mysql/Percona 5.5
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- ubuntu下chrome无法同步问题解决
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- Ubuntu Linux使用体验
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例