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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:06:56+00:00 2026-06-05T20:06:56+00:00

This is probably something really simple but for some reason I just can’t seem

  • 0

This is probably something really simple but for some reason I just can’t seem to do it.

I’m trying to output some data from a blog (app) that I have created. The blog is working fine and out putting the content in the model fields that I have created and outputting to the templates I have specified.

But when tryingn to output the information out to the homepage nothing is showing. I’m fairly new to django and I think I might be missing something.

Do I need to include something to pages that are outside of the app? or do I need to set up somethin in the urls file?

I hope this makes sense as I don’t think it’s anything to complicated but I just think I’m missing something!

Thanks.

CODE:

url(r'blog/(?P<slug>[-\w]+)/$', 'blog.views.blog', name="blog"),
   url(r'blog/', 'blog.views.blog_index', name="blog_index"),


def blog_index(request):
    blogs = Blog.objects.filter(active=True)

    return render_to_response('blog/index.html', {
        'blogs':blogs,
    }, context_instance=RequestContext(request))

def blog(request, slug):
    blog = get_object_or_404(Blog, active=True, slug=slug)

    return render_to_response('blog/blog_post.html', {
        'blog': blog
    }, context_instance=RequestContext(request))





class Blog(TimeStampedActivate):
    title = models.CharField(max_length=255, help_text="Can be anything up to 255 character")
    slug = models.SlugField()
    description = models.TextField(blank=True, help_text="Give a short description of the news post")
    content = models.TextField(blank=True, help_text="This is the main content for the news post")
    user = models.ForeignKey(User, related_name="blog")

    def __unicode__(self):
        return self.title

    @models.permalink
    def get_absolute_url(self):
        return ('blog', (), {
            'slug': self.slug
        })
  • 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-05T20:06:58+00:00Added an answer on June 5, 2026 at 8:06 pm

    Are you saying that going to mysite.com/blog/ is displaying correctly, but you also want it to be the sites index page at mysite.com?

    If so, you need to add a new pattern to your projects urls.py file, like so:

    url(r'^$', 'blog.views.blog_index')

    Doing this will make mysite.com/blog/ and mysite.com route to the same view.

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

Sidebar

Related Questions

So this is probably really simple but for some reason I can't figure it
This is probably something really simple but I cant see what! Any images I
This is probably stupid simple, but for some reason I'm having trouble getting it
I'm probably making a really simple error somewhere, but for some reason the event
This is probably something simple but it's driving me nuts. I'm making some pagination
I am probably overlooking something really simple here but I am trying to redirect
This is probably something really simple, however I am quite new to PHP, and
This is probably a pretty basic question, but just something that I wanted to
I'm a bit new to make, so this is probably something really very simple,
Probably simple question and I'm just missing something, but I'm stuck out of ideas.

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.