» how to show content depending on domain/subdomain
how to show content depending on domain/subdomain
|August 23, 2014
Posted by forumadmin
I am trying to write a little blog where only some specific content of blog should show up depending on domain/subdomain.
lets say, the main blog is at
www.mainblogsite.com. here I want to show all blog entries.
But lets say, there is also a subdomain of main blog, called
www.fr.mainblogsite.com where only blog entries in french should show up.
I am writing the blog in Django.
my first thoughts on database modelling were like this:
text = models.TextField()
lang = models.CharField(max_length="2")
I just get the domain with
request.META['HTTP_HOST'] and depending on domain name, i will filter blog entries by language like
which gives me only french blog entries for
my question is: does this database architecture make sense? I dont know much about how domains and subdomains work,.. how and where could it be better?
More Related Questions
- Django object not saving even after "save" call I'm really at a loss because this makes no sense at all. I call save/create an object, and it dosn't show up in the admin site. I even checked the SQLite database with a SQLite Viewer […]
- Django TemplateSyntaxError: Invalid filter: truncatechars Getting TemplateSyntaxError: Invalid filter: 'truncatechars' in app engine. I'm using latest django library. As per "Third-party Libraries in Python 2.7 on appengine" django latest […]
- filter admin show in django by users I add one ManyToManyField to my Users profile:
user = models.OneToOneField(User)
news_letters = models.ManyToManyField(news_letter)
and replace it […]
- read facebook with django Hi I live in iran and because of filtering we can´t access facebook directly so I want to write a django application to read news feeds ,wall posts and update status. How should I […]
- Running two seperate Django site from one apache I am running Ubuntu 14.04 on my notebook and I am using Django 1.6.4 (with virtualenv) together with Apache 2.4.7.
I would like to access two django projects through my local apache. […]
- Django duplicate entry key I thought it would be neat to pick up a Duplicate entry exception and display the specific field witch caused the error to the user.
"Duplicate entry […]
- Django TestCase: dont flush the DB after each test I'm working on a Django API project with a rather unusual configuration (I think):
I have indeed two Django projects: one is the main API and one is the user API. Whenever I create a user […]
- Separation of business logic and data access in django I am writing a project in Django, and I see that 80% of the code is in the file models.py. This code is confusing and after a certain time, I cease to understand what is really […]
- What CMS runs on Google App Engine? Is it possible to deploy any CMS (Content Management System) using Google App Engine? Wikipedia lists 4 Python CMSes and one of them is Django based.
Do you know any way to make any of […]
- Celery multi with queues set up not receiving tasks from django I am running my workers with the following command:
celery -A myapp multi start 4 -l debug -Q1:3 queue1,queue2 -Q:4 queue3
The workers start out very well so when i run