I wish to offer specialized Nourishes on the different subdomain in the relaxation from the site.
Can One make use of the sites framework to utilize a different web addresses.py and configurations.py file inside a single django instance. or should i setup two apache locations and merely set the various configurations.py files within the apache conf.
The main reason I have to setup two web addresses.py files would be to avoid duplicate content. I'm not going the primary site to be shown at rss.example.com and I'm not going the specialized feeds to become accessible on example.com
Serving them from one django instance could be ideal because we are on hosting that is shared with limited memory, also it appears like this type of waste with an instance open that only delivers rss.
edit: I came to the conclusion that multiple instances with seperate web addresses.py files could be simplest for me personally... however i found this short article explaining how to get it done utilizing a single instance:
Solution: Django tupperware
I wound up writing a framework for running multiple copies of the site on one django instance.
The fundamental idea would be to change the
SITE_ID setting quickly for every request and load alternate configurations in the database. It will this according to domain and uses
SITE_ID = 1 automatically (if this aren't able to find anything)
All configurations within the configurations.py file behave as defaults that are overridden through the configurations saved within the database for that current site.
It really works pretty much :) and it is running being produced at http://rootbuzz.com
With stock Django you'll want a distinctive
settings.py for every site... since the SITE_ID is determined in
settings.py and is paramount that website is handling this request.
Quite simply, SITE_ID is global for your instance and for that reason you'll need a case for every site.
You'll have a common
urls.py if you want due to there being nothing stopping you against utilizing the same
ROOT_URLCONF in most your website
settings.py files... or have diffent one for every site. Within this situation you would like to include sub Web addresses to avoid repeating yourself for just about any common Web addresses.
You will find a minimum of two techniques you can test for everyone from one instance:
Use apache + mod_wsgi and employ the WSGIApplicationGroup and/or WSGIProcessGroup directives. I have never needed these before so can not be completely sure these works how you want, but regardless you are able to certainly use mod_wsgi in daemon mode to greatly enhance your memory footprint.
You are able to have fun with Django middleware to deny/allow Web addresses in line with the request hostname (see HttpRequest.get_host() within the Django paperwork). For your matter, despite the fact that it might be a small performance hit, place the a decorator on all of your sights that inspections the incoming host.
FYI - I launched django-dynamicsites which may be useful with this particular problem - https://bitbucket.org/uysrc/django-dynamicsites/src