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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:15:14+00:00 2026-06-13T23:15:14+00:00

I keep receiving the error Could not import movies.views. Error was: No module named

  • 0

I keep receiving the error Could not import movies.views. Error was: No module named models

Here is my traceback:

    Environment:


    Request Method: GET
    Request URL: http://localhost:8000/movies/awesome-movie/

    Django Version: 1.3.1
    Python Version: 2.7.3
    Installed Applications:
    ['django.contrib.auth',
     'username_patch',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.admin',
     'django.contrib.flatpages',
     'south',
     'tagging',
     'tagging_autocomplete',
     'accounts',
     'movies',
     'tracking',
     'djcelery',
     'pagination']
    Installed Middleware:
    ('django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.middleware.locale.LocaleMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
     'pagination.middleware.PaginationMiddleware')


    Traceback:
    File "/Users/jeff/Code/filmlibrary/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
      101.                             request.path_info)
    File "/Users/jeff/Code/filmlibrary/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
      252.                     sub_match = pattern.resolve(new_path)
    File "/Users/jeff/Code/filmlibrary/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
      252.                     sub_match = pattern.resolve(new_path)
    File "/Users/jeff/Code/filmlibrary/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
      158.             return ResolverMatch(self.callback, args, kwargs, self.name)
    File "/Users/jeff/Code/filmlibrary/lib/python2.7/site-packages/django/core/urlresolvers.py" in _get_callback
      167.             raise ViewDoesNotExist("Could not import %s. Error was: %s" % (mod_name, str(e)))

    Exception Type: ViewDoesNotExist at /movies/awesome-movie/
    Exception Value: Could not import movies.views. Error was: No module named models

I am not sure why I have this error. My code is as follows…

I have an django app called tracking and another called movies. I have a python file called tracking.py in the tracking app it consists of the following code:

filmlibrary/tracking/tracking.py

from movies.models import Movie
from tracking.models import MovieView

import os
import base64

def tracking_id(request):
    try:
        return request.session['tracking_id']
    except KeyError:
        request.session['tracking_id'] = base64.b64encode(os.urandom(36))
        return request.session['tracking_id']

def log_movie_view(request, movie):
    t_id = tracking_id(request)
    try:
        v = MovieView.objects.get(tracking_id=t_id, movie=movie)
        v.save()
    except MovieView.DoesNotExist:
        v = MovieView()
        v.movie = movie
        v.ip_address = request.META.get('REMOTE_ADDR')
        v.tracking_id = t_id
        v.user = None
        if request.user.is_authenticated():
            v.user = request.user
        v.save()

The above is pretty basic stuff. My views.py in my movies app uses the tracking.py file here:

filmlibrary/movies/views.py

@login_required
def movie_details(request, slug, template_name="movies/movie_detail.html"):
    movie = get_object_or_404(Movie, slug=slug)
    movie.tracking_id = tracking.tracking_id(request)
    movie.save()
    tracking.log_movie_view(request, movie)
    context = RequestContext(request, {'movie': movie })
    if movie:
        try:
            screener = movie.moviemedia_set.get(movie_type='screener')
            .... continued

UPDATE:

Here are the contents of filmlibrary/tracking/models.py

from django.db import models
from django.contrib.auth.models import User

from movies.models import Movie

class PageView(models.Model):
    class Meta:
        abstract = True

    date = models.DateTimeField(auto_now=True)
    ip_address = models.IPAddressField()
    user = models.ForeignKey(User, null=True)
    tracking_id = models.CharField(max_length=50, default='')

class MovieView(PageView):
    movie = models.ForeignKey(Movie)

The error appears to come from the import line from tracking.models import MovieView in the tracking.py file and I am not sure why. As soon as I comment out that line the error goes away but then of course I’ll have new errors about MovieView not existing as expected. I don’t see anything wrong with that import line in tracking.py.

Does anyone have any suggestions as to why I receive that error and how I can resolve this?

  • 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-13T23:15:15+00:00Added an answer on June 13, 2026 at 11:15 pm

    Can you try

    from models import MovieView

    instead of

    from tracking.models import MovieView

    The reason being both models.py and tracking.py are in the same app folder “tracking”, you don’t need to write tracking.models, this will make Django think that you have a folder named models inside the tracking directory.

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

Sidebar

Related Questions

I keep on receiving this error: Showing app/views/posts/index.html.haml where line #115 raised: app/views/posts/index.html.haml:115: syntax
I keep receiving the error LINQ to Entities does not recognize the method 'System.String
I am not sure what the problem is but I keep receiving this error
I keep receiving this error... [2012-06-14 11:54:50,072: ERROR/MainProcess] Hard time limit (300s) exceeded for
I'm trying to implement my own GenericIdentity implementation but keep receiving the following error
The error that I keep on receiving when running a regression uite, can someone
Keep getting the error Arguments are not sufficiently instantiated for the multiplication by addition
I keep on receiving this error message. I followed the instructions but it seems
I'm trying to mock MouseButtonEventArgs.GetPosition() with Moq, but I keep receiving this error: System.ArgumentException:
I am keep receiving this error on my magento pages in frontend and back-end.

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.