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 6989911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:16:35+00:00 2026-05-27T19:16:35+00:00

I am doing this on Fedora Problem: (sandbox)[root@localhost mysite]# django-admin.py runserver Error: Could not

  • 0

I am doing this on Fedora

Problem:

(sandbox)[root@localhost mysite]# django-admin.py runserver
Error: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings

Setup virtualenv

mkdir pythonenv           # that's the /home/yeukhon/pythonenv/*.*
cd pythonenv
virtualenv --no-site-packages --distribute sandbox

Install Django

pip install -E sandbox django

#    changing mode of /home/yeukhon/pythonenv/sandbox/bin/django-admin.py to 755
#    Successfully installed django

Under /home/yeukhon/pythonenv/sandbox

bin   include  lib  mysite

Under lib

You have /lib/python2.7/site-packages/django/*.*

Create Project is fine

(sandbox)[root@localhost sandbox]# django-admin.py startproject mysite
# the path is now /home/yeukhon/pythonenv/sandbox/mysite/*.*

Can’t run server

django-admin.py runserver
Error: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings

Python Shell under sandbox
(following this guide: How to troubleshoot – ImportError: Could not import settings ‘mysite.settings’ when deploying django?)

(sandbox)[root@localhost mysite]# python
Python 2.7.2 (default, Oct 27 2011, 01:36:46) 
[GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> import os
>>> os.environ['DJANGO_SETTINGS_MODULE'] 
'mysite.settings'

>>> os.path.exists('/home')
True
>>> os.path.exists('/home/yeukhon/pythonenv/sandbox/mysite')
True
>>> os.path.exists('/home/yeukhon/pythonenv/sandbox/mysite/settings.py')
True
>>> from django.core.management import setup_environ
>>> import mysite.settings
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named mysite.settings

>>> setup_environ(mysite.settings)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'mysite' is not defined


>>> print sys.path
['', 
/home/yeukhon/pythonenv/sandbox/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg', 
'/home/yeukhon/pythonenv/sandbox/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg', 
'/home/yeukhon/pythonenv/sandbox/lib/python27.zip',
'/home/yeukhon/pythonenv/sandbox/lib/python2.7',
'/home/yeukhon/pythonenv/sandbox/lib/python2.7/plat-linux2',
'/home/yeukhon/pythonenv/sandbox/lib/python2.7/lib-tk',
'/home/yeukhon/pythonenv/sandbox/lib/python2.7/lib-old',
'/home/yeukhon/pythonenv/sandbox/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/home/yeukhon/pythonenv/sandbox/lib/python2.7/site-packages'

What do I need to do to correct this problem? Thank you for your time.


EDIT

Thanks for the response.

I tried the following:

(sandbox)[root@localhost mysite]# export PYTHONPATH="/home/yeukhon/pythonenv/sandbox/"
(sandbox)[root@localhost mysite]# export PYTHONPATH="/home/yeukhon/pythonenv/"
(sandbox)[root@localhost mysite]# deactivate
[root@localhost mysite]# source ../bin/activate
(sandbox)[root@localhost mysite]# django-admin.py runserver
Error: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings

>>> sys.path
['',.... '/home/yeukhon/pythonenv'.....]

It is now on the python path. But I still can’t run the server.

Centralized Django Project

Yes. That’s a good suggestion.
So I suppose that all I need to do is “create a directory called mydjango, then create projects within mydjango”. But what commands need to be changed / added? I am willing to learn good practice.

Thank you very much.


Solution (Add to environment variable)

PYTHONPATH=$PYTHONPATH:path-to-your-directory

# PYTHONPATH=$PYTHONPATH:/home/yeukhon/pythonenv/sandbox/
  • 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-05-27T19:16:36+00:00Added an answer on May 27, 2026 at 7:16 pm

    The last line tells you all you need to know. In order to import mysite.settings, the parent directory of mysite must be on your PYTHONPATH. It currently isn’t.

    FWIW, it’s not typical to actually store your project in the virtualenv directory. Usually, you put all your projects in on directory that you put on your PYTHONPATH. Then, just load up whatever virtualenv you need, and all’s good. In fact, the best part of virtualenv is that they’re interchangeable; i.e., you could easily run the same project in multiple different virtualenv environments (such as for testing a new release of Django without altering your normal virtualenv), but there again, you want your projects in one centralized place instead of inside a particular virtualenv directory.

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

Sidebar

Related Questions

doing this in AppDelegate: viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; Is there any problem
I tried doing this but then it is not working <?php if ($_SERVER['SERVER_NAME']=='http://www.testground.idghosting.com/idi' &&
I'm doing this problem: http://www.codechef.com/problems/FCTRL I have the solution, but, the memory usage is
I am doing this with root privileges. But still I am getting access denied
Please help me on this. I am doing this on Fedora 16. My virtual
If I was doing this in a higher level language I could either use
I'm doing this in an AsyncTask, everything working fine but my view is not
Im doing this project where i need to download files through a webservice (images,
I have some code doing this : var changes = document.getElementsByName(from); for (var c=0;
I'm doing this system Stacked and I am creating the search function. And in

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.