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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:08:31+00:00 2026-05-11T19:08:31+00:00

I’ve building a app right now that I’m trying to keep properly decoupled from

  • 0

I’ve building a app right now that I’m trying to keep properly decoupled from the other apps in my Django project (feel free to lecture me on keeping Django apps decoupled, I’d be happy to learn more any/all the time).

My problem is this: The get_ absolute_url() method I’ve written is returning a relative path based on my view. I think it’s wrong to have to add a special named view in the project urls.py just so I can have absolute urls in my app, and I can’t figure out what I’m doing wrong. So if someone can help me out, I’ll really appreciate it (and mention you when I release this sucker!)

I have a project-level urls.py that includes another urls.py based on the URL pattern like so (the names are verbose for this example only):

project-urls.py

urlpatterns = patterns('',
    ('^$', direct_to_template, {'template': 'base.html'}),
    (r'^app', include('project.app.urls')),
)

app-urls.py

urlpatterns = patterns('',
    url(r'(?P<slug>[-\w]+)?/?$', 'app.views.home', name='app_home'),
)

Now, in my Model, I have something like this:

class AppModel(models.Model):
    title               = models.CharField(_('title'), max_length=100)
    slug                = models.SlugField(_('slug'), unique=True)

    @permalink
    def get_absolute_url(self):
        return ('app_home', None, {'slug': self.slug})

When I call {{ AppInstance.get_ absolute_url }} in the template, I get something like this:

/slug-is-here

Which is obvs not absolute & makes sense based on my urls.py. What should I change to get a real absolute url while keeping this app clean & not couple it too deeply w/the project?

  • 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-11T19:08:31+00:00Added an answer on May 11, 2026 at 7:08 pm

    Welp,

    It turns out that when I was seeing this:

    /slug-is-here
    

    I should have looked closer. What was really happening was:

    /app-pathslug-is-here
    

    I was missing a trailing slash on my app’s regex in my project urls.py.

    So yea. let that be a lesson to y’all.

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

Sidebar

Related Questions

No related questions found

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.