Forums

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

Hello,

I set up the virtual environment variable for Django 1.8 as per the instructions in the Django tutorial (1.8) and the (almost) matching 1.7 tutorial on PythonAnywhere. When I go into Bash and follow the instructions to check the Django version it confirms that I have version 1.8. installed.

I am up to part 3 in the Django tutorial at this URL:

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

In mysite/urls.py the tutorial tells me to write this:

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)),
]

However, when I actually opened the file I was presented with this:

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)),
)

The tutorial then has this to say:

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.

As I said though, Bash confirms that I Do have Django 1.8 installed. What am I missing here? Why do I not have the correct files for Django 1.8 even though that's what I supposedly installed? It was definitely taking a few minutes to copy files, so where did it put them?

I tried to make the files match the tutorial files, but it only resulted in an error appearing on my public site.

I also just checked. The files I am seeing don't even match version 1.7.

The most likely cause of that is that you ran startproject without your virtualenv activated. Something that may not be entirely clear, is that the Following the Django Tutorial page in the PythonAnywhere help is not a stand-alone tutorial, it is a supplement to the main Django tutorial describing anything extra or different that you need to do on PythonAnywhere to work through the main Django tutorial.

Okay, I will go back to the beginning and restart the project. I was confused during the initial stages of my first setup, especially the stage involving virtual environment variables, so it is possible that my installation got a little messed up.

I've added a suggestion to the "Following" page that tells readers of one way to check that their settings.py matches the right django version, right at the beginning... thanks again for helping us improve the page!