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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:38:40+00:00 2026-06-17T15:38:40+00:00

So I set up a virtualenv on Ubuntu, installed everything, and got the development

  • 0

So I set up a virtualenv on Ubuntu, installed everything, and got the development site running with runserver. All my own unit tests passed, but many of the Django packages’ unit tests were not passing.

So I tried doing git bisect to figure this out, checking out the very earliest commits I had made. I went too early in history, back when the development environment was using different database engines, packages, etc., and the site of course couldn’t run. I then decided to work on something else more important than failing Django unit tests (since my own were working), and so I went back to the latest commit in the development branch.

I fired up runserver again, but this time when I reloaded the homepage, I was met with the error:

Traceback:
File "...venv.../local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  101.                             request.path_info)
File "...venv.../local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
  298.             for pattern in self.url_patterns:
File "...venv.../local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  328.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "...venv.../local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  323.             self._urlconf_module = import_module(self.urlconf_name)
File "...venv.../local/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "...project dir.../myproject/urls.py" in <module>
  2. import frontpage.views

Exception Type: ImportError at /
Exception Value: No module named views

Everything was working just fine before I tried the git bisect. But not any more, at least on my local machine.

So I googled around, and changed my ROOT_URLCONF from 'myproject.urls' to just 'urls'. Now I get this error message:

Traceback:
File "...venv.../local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  101.                             request.path_info)
File "...venv.../local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
  298.             for pattern in self.url_patterns:
File "...venv.../local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  328.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "...venv.../local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  323.             self._urlconf_module = import_module(self.urlconf_name)
File "...venv.../local/lib/python2.7/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)

Exception Type: ImportError at /
Exception Value: No module named urls

I googled some more and thought maybe my Python path didn’t include my project directory… but no, it totally does when I included a print sys.path in my settings.py file for the project!

So what’s the problem here? I am using Django 1.4.3, and starting the server using python manage.py runserver. I swear my website was working just a few hours ago, and I’ve since done git checkout development and git reset many times… I’ve tried deleting the virtualenv, recreating it, and reinstalling all the Python packages. I’m still getting the same error.

(Also, I did activate the virtualenv, and I’ve even tried restarting, just in case… no luck so far)

UPDATE

Following Lennart’s suggestion, I started the debugger right before the failing import, and found that import frontpage works, but not import frontpage.views, frontpage.tests, or anything else. I do have an __init__.py file in the frontpage directory as well. At this point, sys.path contains my project folder all right…

I have already been including frontpage in my INSTALLED_APPS as well.

FIXED

Thanks to Lennart, I checked that the frontpage module was indeed getting imported correctly. The correct .pyc file was shown, but this made me wonder if the pyc files were somehow out of sync with my actual code.

So I deleted all the pyc files, restarted the server, and everything is working fine once more 🙂

  • 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-17T15:38:41+00:00Added an answer on June 17, 2026 at 3:38 pm

    Sometimes you get ImportErrors because the module you try to import encounters some problem. For example maybe frontpage.view is trying to import a module that has a SyntaxError. The best way to figure out exactly what is going on is to put an import pdb;pdb.set_trace() just before the failing import and try to step inside the import.

    Also make sure that when you import frontpage that you get the module back you expect, check specifically the modules __file__ attribute, and that it is the __init__.pyc you expect.

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

Sidebar

Related Questions

I have a virtualenv all set up with the --no-site-packages flag on. When I
I have virtualenv set up and working correctly on my mac os (leopard) running
I'm trying to set up a virtualenv for local development using Google App Engine
set Unified=C:\Workspaces\Main\Unified\UnifiedFX.sln set Fullserver=C:\Workspaces\Main\Unified\FullServer\Tests\FullServer.Automation\FullServer.Automation.csproj set Management=C:\Workspaces\Main\Unified\Management\Tests\Management.Automation\Management.Automation.csproj set Move=C:\Workspaces\Main\Unified\Move\Tests\Move.Automation\Move.Automation.csproj set d64=Debug|x64 set d86=Debug|x86 for %%a
I currently have git and virtualenv set up in a way which exactly suits
I set up a virtualenv , which is working, but for some reason I
I have created a virtualenv with the --no-site-packages option. I get an error trying
Possible Duplicate: Can I change an an existing virtualenv to ignore global site packages?
As root, I'm trying to set up a dev server running Debian Squeeze with
I have a VPS running a fresh install of Ubuntu 10.04 LTS. I'm trying

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.