为什么我的文件与 Django 1.8 安装不匹配,即使 Bash 确认我已经安装了一个?

Why do my files not match a Django 1.8 installation even though Bash confirms I have one installed?

我按照 Django 教程 (1.8) 和(几乎)匹配的 PythonAnywhere 1.7 教程中的说明为 Django 1.8 设置了虚拟环境变量。当我进入 Bash 并按照说明检查 Django 版本时,它确认我有 1.8 版。已安装。

我即将完成 Django 教程的第 3 部分 URL:

https://docs.djangoproject.com/en/1.8/intro/tutorial03/

在mysite/urls.py中教程告诉我这样写:

from django.conf.urls import include, url
from django.contrib import admin

    urlpatterns = [
    url(r'^polls/', include('polls.urls')),
    url(r'^admin/', include(admin.site.urls)),
]

但是,当我实际打开文件时,我看到的是:

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'mysite.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
)

教程然后是这样说的:

Doesn’t match what you see? If you’re seeing admin.autodiscover() before the definition of urlpatterns, you’re probably using a version of Django that doesn’t match this tutorial version. You’ll want to either switch to the older tutorial or the newer Django version.

正如我所说,Bash 确认我确实安装了 Django 1.8。我在这里错过了什么?为什么我没有正确的 Django 1.8 文件,即使我应该安装它?

我试图使文件与教程文件相匹配,但它只导致我的 public 网站上出现错误。

最可能的原因是你在 运行 startproject 时没有激活 virtualenv,所以你从 PythonAnywhere 获得了默认的 Django 而不是你安装的 Django。