Hi Im going through the Django tutorial and after saving and running it says DJANGO_SETTINGS_MODULE is undefined in the console.

when I go to my project homepage it gives error messages too

here is the full message:

Traceback (most recent call last): File "/home/slenkar/hurling/", line 4, in <module> from django.contrib import admin File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/", line 3, in <module> from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/", line 3, in <module> from django.contrib.admin.util import (flatten_fieldsets, lookup_field, File "/usr/local/lib/python2.7/site-packages/django/contrib/admin/", line 1, in <module> from django.db import models File "/usr/local/lib/python2.7/site-packages/django/db/", line 14, in <module> if not settings.DATABASES: File "/usr/local/lib/python2.7/site-packages/django/utils/", line 276, in getattr self._setup() File "/usr/local/lib/python2.7/site-packages/django/conf/", line 40, in _setup raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

here is

from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

urlpatterns = patterns('',
    # This is going to be our home view.
    # We'll uncomment it later
    # url(r'^$', 'mysite.myapp.views.home', name='home'),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(,

# Uncomment these two lines to enable your static files on PythonAnywhere
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns += staticfiles_urlpatterns()

Hi there -- I'm not quite sure what you mean by the console -- are you trying to use "Save and run" on the file? That won't actually do anything useful, it'll just run the file in an environment that's not configured for Django.

I missed the bit where it says to run:'python syncdb' to get to the next part of the tutorial

I started following the next tutorial on the django website but it needed django,utils.timezone which doesnt seem to be available, which version of django is used on this website?

I looked online and it said utils.timezone isnt available for django 1.3

EDIT- I have to import datetime from datetime

That makes sense. On the Django website there are tutorials for older versions -- look for the link at the bottom, and you can find the one for version 1.3, which is our default right now.

Alternatively, you can use Django 1.4 on PythonAnywhere -- it requires a bit of setup, though -- see here: