Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7865533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:07:07+00:00 2026-06-03T00:07:07+00:00

In the Django documentation on Models , the first command that I am asked

  • 0

In the Django documentation on Models, the first command that I am asked to run and python’s response was:

>>> from django.db import models

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from django.db import models
  File "C:\Python26\lib\site-packages\django\db\__init__.py", line 11, in <module>
        if DEFAULT_DB_ALIAS not in settings.DATABASES:
  File "C:\Python26\lib\site-packages\django\utils\functional.py", line 184, in inner
    self._setup()
  File "C:\Python26\lib\site-packages\django\conf\__init__.py", 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.

As you can see from the stack trace, I am running a django server in python 2.6.6. Could anyone offer me a clue to start off on the right foot with this tutorial? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:07:09+00:00Added an answer on June 3, 2026 at 12:07 am

    Are you running these commands from ./manage.py shell? You cannot run django commands from the regular python shell without specifying where your settings.py file is for the project. Django’s ./manage.py shell command specifies that for you, making it easier to do django stuff on the command line.

    If you don’t see a file named manage.py in your current working directory, then that probably means you’re not in the directory of your django application, or you haven’t started one yet.

    Edit: Also, that documentation is meant as an example of what to put in your application’s models.py file, not something you should type in on the command line. That doesn’t mean it won’t work on the command line (if you use manage.py shell) but it isn’t what the documentation is suggesting. Check the tutorial if you’re unclear on how to start the shell and what files go where.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

from django.conf.urls.defaults import * from django.conf import settings from Website.Blog.models import Post # Uncomment
This is my models.py from django.db import models class School(models.Model): school = models.CharField(max_length=300) def
Currently I have the from django.contrib.auth.models import User but I'm confused as to how
This example is from the Django documentation . Given the (Django) database model: class
From the Django documentation... When you're only dealing with simple many-to-many relationships such as
From the documentation : Django provides a hook for passing the database arbitrary SQL
I read today that Django 1.3 alpha is shipping, and the most touted new
Say I have django model that looks something like this: class Order(models.Model): number =
I'm using Django-social-auth for the first time, and it seems that all the new
In Django documentation for setting timezone , the list of available choices for timezone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.