The GIS Guy
  • Home
  • iOS
  • Web
  • GIS

Python

A collection of 2 posts

Python

Django 1.7 render() 函数传递 request 对象导致 Value Error

升级到 Django 1.7之后发现打开任何页面都会出现 Value Error。 分析调用栈后发现,导致错误的原因是 render() 函数: def index(request): context = RequestContext(request, {}) return render(request, 'index.html', context) # 这一行第三个参数导致 Value Error Django 1.7 中的 render() 函数会自动将RequestContext加入到上下文中,因此,没有必要不能再将

Jon Jon
Python

使用 VirtualEnv 配置 Python 虚拟环境

在同一台机器上开发多个 Python 项目,经常会碰到某个包的版本不一致的问题。VirtualEnv 可以为每个的项目提供独立的配置,避免冲突,绝对是居家旅行必备工具。 VirtualEnv 的安装很简单,pip install VirtualEnv 一行命令即可(前提是已经安装了 pip 包管理工具)。 安装完成后,对需要使用 VirtualEnv 的项目需要手动进行‘初始化’。切换到工程目录,运行 $ virtualenv venv $ ./venv/scripts/activate 上面使用了两个命令。首先通过 virtualvnv 命令创建一个名为

Jon Jon
The GIS Guy © 2025
Latest Posts Ghost