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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:56:07+00:00 2026-05-12T13:56:07+00:00

I just pulled from my github and tried to setup my application on my

  • 0

I just pulled from my github and tried to setup my application on my Ubuntu (I originally ran my app on a Mac at home).

I re-created the database and reconfigured the settings.py — also update the template locations, etc.

However, when I run the server “python manage.py runserver” get an error that says:

ImportError: cannot import name Count

I imported the Count in my views.py to use the annotate():

from django.shortcuts import render_to_response
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.db.models import Count
from mysite.blog.models import Blog
from mysite.blog.models import Comment
from mysite.blog.forms import CommentForm

def index(request):
    #below, I used annotate()
    blog_posts = Blog.objects.all().annotate(Count('comment')).order_by('-pub_date')[:5]

    return render_to_response('blog/index.html', 
                             {'blog_posts': blog_posts})

Why is not working?

Also, if I remove the “import Count” line, the error goes away and my app functions like normal.

Thanks,
Wenbert

UPDATE:

my models.py looks like this:

from django.db import models

class Blog(models.Model):
    author = models.CharField(max_length=200)
    title = models.CharField(max_length=200)
    content = models.TextField()
    pub_date = models.DateTimeField('date published')

    def __unicode__(self):
            return self.content

    def was_published_today(self):
            return self.pub_date.date() == datetime.date.today()

class Comment(models.Model):
    blog = models.ForeignKey(Blog)
    author = models.CharField(max_length=200)
    comment = models.TextField()
    url = models.URLField()
    pub_date = models.DateTimeField('date published')

    def __unicode__(self):
            return self.comment

UPDATE 2

My urls.py looks like this:

from django.conf.urls.defaults import *

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/(.*)', admin.site.root),
    (r'^blog/$','mysite.blog.views.index'),
    (r'^display_meta/$','mysite.blog.views.display_meta'),
    (r'^blog/post/(?P<blog_id>\d+)/$','mysite.blog.views.post'),
)
  • 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-12T13:56:08+00:00Added an answer on May 12, 2026 at 1:56 pm

    This sounds like you’re not using Django 1.1. Double check by opening up the Django shell and running

    import django
    print django.VERSION
    

    You should see something like (1, 1, 0, 'final', 0) if you’re using 1.1

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

Sidebar

Related Questions

My friend just shared me this new application and I pulled it from heroku
I just pulled the 2010 ultimate from MSDN, and I see there's no Smart
Having just pulled my hair off because of a difference, I'd like to know
When it's pulled from the db, it comes out like this: 2010-02-28 10:00:00 I'm
In a team environment on a Linux system I just pulled the latest code
Ive got an associative array thats pulled from mysql results and id like to
I am trying to write some data pulled from some source code (using httplib2
I'm populating a textarea with previous input of a user. This is pulled from
This WPF app targets .NET 3.5 and is built with the 4.0 tools from
Just what the title says, I need to change the password for an existing

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.