1👍
I think simplest solution will be:
django muliple databases + lets say, PostgreSQL DB allowing crossdomain access.
Create router for your blog app and use any db you want.
UPD:
Somewhere
# class for routing db operations for some blog myapp
class MyAppRouter(object):
"""A router to control all database operations on models in
the myapp application"""
def db_for_read(self, model, **hints):
"Point all operations on myapp models to 'other'"
if model._meta.app_label == 'myapp':
return 'other'
return None
def db_for_write(self, model, **hints):
"Point all operations on myapp models to 'other'"
if model._meta.app_label == 'myapp':
return 'other'
return None
def allow_relation(self, obj1, obj2, **hints):
"Allow any relation if a model in myapp is involved"
if obj1._meta.app_label == 'myapp' or obj2._meta.app_label == 'myapp':
return True
return None
def allow_syncdb(self, db, model):
"Make sure the myapp app only appears on the 'other' db"
if db == 'other':
return model._meta.app_label == 'myapp'
elif model._meta.app_label == 'myapp':
return False
return None
in settings.py
DATABASES = {
'default': {
...
# Project DB
}
# Blog DB
'blog': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'test',
'USER': 'postgres',
'PASSWORD': 'admin',
'HOST': '111.111.111.111',
'PORT': '5432',
}
}
...
DATABASE_ROUTERS = ['path.to.MyAppRouter', 'path.to.MasterSlaveRouter']
2👍
The question is very, very hard to follow.
Two django sites which share a common app is trivial. It’s done all the time.
You’re simply sharing the app code among the two sites.
Use subversion to keep the master copy of the blog
app.
Checkout working copies for both sites.
I want to this “blog” app to be like a service, which can be used by any 3rd party site.
I think I’m trying to do is use my Django App as a service.
This is trivial also. Use Piston to create a RESTful web service around your blog app.
handle the read/writes through an API but this would get quite cumbersome.
Not really. RESTful web services are quite trivial. Use httplib
to be a client of a RESTful web service.
- [Django]-Error during template rendering (invalid block tag 'nospaceless')
- [Django]-Optimized way of passing a form in all view functions django