使用错误的Django版本的virtualenv中的manage.py runserver [英] manage.py runserver in virtualenv using wrong django version

查看:77
本文介绍了使用错误的Django版本的virtualenv中的manage.py runserver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个virtualenv并在其中安装了Django 1.5

I created a virtualenv and installed Django 1.5 in it

(virtpy33) c:\django_projects>python
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on      win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(1, 5, 1, 'final', 0)
>>> ^Z

然后我创建了一个项目并运行manage.py runserver,但它说它正在运行1.4版

then I created a project and ran manage.py runserver, but it says it's running version 1.4

(virtpy33) c:\django_projects>django-admin.py startproject virtres
(virtpy33) c:\django_projects>cd virtres
(virtpy33) c:\django_projects\virtres>manage.py runserver
Validating models...
0 errors found
Django version 1.4, using settings 'virtres.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

我是virtualenv和Django的新手。我还有什么需要做的吗?喜欢编辑settings.py文件或manage.py文件之类的东西吗?

I'm new to virtualenv and Django. Is there anything else I need to do? Like edit the settings.py file or manage.py file or something?

我的系统(Windows Vista)上的Django 1.4在我的Python27目录下(不在虚拟环境中),但是我设置了virtualenv,因此可以使用Django 1.5和Python 3。

I have Django 1.4 on my system (Windows Vista) under my Python27 directory (not in a virtual environment), but I set up a virtualenv so I could use Django 1.5 and Python 3.

请帮助!

推荐答案

运行时Windows单独使用 manage.py ,将其从主Windows PATH 中拉出,然后从Windows与Python的主要关联,这是Python的默认安装版本,因此不在您的virtualenv中。

When you run manage.py on its own, Windows is pulling it off of the main Windows PATH, and then running it off of the main Windows association with Python, which is your default installed version of Python, and thus outside your virtualenv.

在您的virtualenv中,尝试运行 python manage.py runserver 看看会发生什么。

Inside your virtualenv, try running python manage.py runserver and see what happens.

这篇关于使用错误的Django版本的virtualenv中的manage.py runserver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆