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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:04:10+00:00 2026-06-03T23:04:10+00:00

I am interested in setting up my application so that I can serve location

  • 0

I am interested in setting up my application so that I can serve location specific content.

Something like craigslist, where miami.craigslist.org only shows posts in miami.

Assuming that I have a model that has a City field, what would be the best way to achieve this?

  • 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-03T23:04:11+00:00Added an answer on June 3, 2026 at 11:04 pm

    Banjer suggested the Sites framework, but I feel like it might not be a 100% perfect fit for your situation. The sites framework works well for different sites sharing the same database. But in your case, its all the same site and you are basically just wanting to pass an argument to your views for the city.

    You could probably do something even simpler by just pointing wildcard *.domain.com to your django site, and then using request.get_host() in the view to parse out the subdomain:
    https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpRequest.get_host

    So if the domain were: “losangeles.domain.com”, and you parsed out “losangeles”, you could use that as your city “tag” in your query. And when you create new content, you can just tag it with a city.

    Post.objects.filter(city_tag="losangeles")
    

    I suppose it depends on how robust of a “location” structure you need in your site. It very well might be a City model with various meta data fields, including the tag field. Then you would associate it with the content as a foreign key. It kind of approaches the same general idea as the Sites framework, but in this case you aren’t really creating different sites.

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

Sidebar

Related Questions

I am interested in windows mobile7 application development and struggling with setting up the
An Android application that I am interested in ( OpenSudoku) has become unmaintained by
I wrote a small PHP application that I'd like to distribute. I'm looking for
I'm interested in setting up a Socket.IO server + Rails web application. However, as
I'm interested in setting up my own website-based game (PBBG) as a hobby. Traffic
When setting up a UITableView's data source, I'd be interested to get views on
im interested how many api calls per second or per minute i can do
I have an application where users can select a variety of interests from around
I have a thread in a Java web application that causes a java.lang.OutOfMemoryError: Java
I'm interested in making an immutable class that has properties that cannot be modified,

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.