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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:32:11+00:00 2026-06-10T20:32:11+00:00

I am trying to add some simple tenancy support to an app, creating an

  • 0

I am trying to add some simple tenancy support to an app, creating an Account model which has a string ‘tenant’ to be read from the request url and identify the tenant in the system:

tenant.example.com/* -> http://www.example.com/tenant/* (rewritten by apache)

I wrote a simple middleware to capture this /tenant/ from request.path and add a request.account object to be worked with.

My problem is my url mapping.

I tried this:

url(r'^(?P<tenant_id>[\w\-]+)/', include('project.urls_tenant')),

and defined some simple urls inside urls_tenant.py:

url(r'^app1/', include('project.app1.urls')),

url(r'^app2/', include('project.app2.urls')),

When I try to access any page, I get an error message:

generic_view_method() got an unexpected keyword argument ‘tenant_id’

because it doesn’t (and really shouldn’t) expect tenant_id as a parameter.

If I hardcode tenant_id in the urls.py file as /test_tenant/ everything works fine.

What am I doing wrong and how to fix it, so the request and the response gets processed normally?

Thank you guys pretty much. I used this as reference: optimal architecture for multitenant application on django

  • 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-10T20:32:12+00:00Added an answer on June 10, 2026 at 8:32 pm

    You are capturing the named parameter tenant_id in the url pattern when you apparently don’t need to. Try removing the parentheses to avoid performing the capture:

    url(r'^[\w\-]+/', include('project.urls_tenant')),
    

    This page is a generally useful read:
    https://docs.djangoproject.com/en/dev/topics/http/urls/#how-django-processes-a-request

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

Sidebar

Related Questions

I'm trying to add some simple peer-to-peer connection functionality to an iOS library. Coding
I was trying to add some non-production test code by creating a 3rd partial
I am trying to add some WebAPI support to my asp.net 4 RC site,
I'm trying to add some navigation controller in my app, it's sth likes: in
I am trying to add some views programatically to a linear layout which is
I'm trying to add some simple user data into a database via a webpage
I'm trying to add some simple statements to a Sesame repository, like so: RepositoryConnection
I am trying to add some simple validation to my asp.net mvc form and
I'm new to C# and am trying to add some simple server side validation
I am trying to write a simple internal app with some simple authentication. I'm

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.