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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:26:30+00:00 2026-05-24T06:26:30+00:00

has anyone ever used wildcard subdomains in their application? I need to come up

  • 0

has anyone ever used wildcard subdomains in their application? I need to come up with a way to ‘localise’ my application. When i say localise i mean anyone who goes to ny.foo.com/items/new/ will be sent to a view which looks through a database and search for new items in ny. Obviously we could replace NY with any state.

Any tips would be great

Thanks!

  • 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-24T06:26:32+00:00Added an answer on May 24, 2026 at 6:26 am

    I would do it using a middleware, eg.:

    class StateCodeMiddleware(object):
    
       def process_request(self, request):
            bits = request.META['HTTP_HOST'].split('.')
            if len(bits) == 3 and len(bits[0]) == 2:
                request.state_code = bits[0]
            else:
                request.state_code = None
                # Or a redirect to the default state.
    

    And then in any of your views, you can just check request.state_code and fetch new items only for that state.


    Edit: For development, the best method is to setup a local DNS server. Eg. dnsmasq is very easy to configure:

    address=/.dev/127.0.0.1 # in dnsmasq.conf

    This makes *.dev point to localhost. You’ll also have to configure your system to use the local DNS server (on UNIX systems you do this by placing nameserver 127.0.0.1 into /etc/resolve.conf).

    Alternatively, you can list all the domain names in your /etc/hosts if it is a finite set:

    127.0.0.1 ny.localhost, az.localhost  # and so on
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey has anyone ever used the API for face detect in their android program?
Has anyone ever used the Bridge pattern in a real world application? If so,
Has anyone ever used the hidden class PackageParser in Android source code with java
Has anyone of you ever used php_writeexcel (http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/)? I would like to know if
Has anyone ever worked with a system of passing back say, some JSON data
is it possible to use SQLite for a j2me application ? has anyone ever
I'm wondering if anyone has ever come across a plug-in for mootools that will
Just curious to know if anyone has ever used gametutorials.com products for learning directX.
Hey all, I'm wondering if anyone has ever used a tool which will take
Has anyone ever used a series of tables togather called a DECODE? This is

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.