How do you setup a Django project with different sites using the same data? -
I am currently looking for documentation for Django sites:
Which describes how to associate the content with multiple sites. Examples used are LJWorld.com and Lawrence.com.
What do the Django project structure look for? For example, each site is an app in its own right:
project / manage.py settings.py urls.py ljworld / models.py views.py Lawrence / Model py views.py
If there is SITE_ID = 1
in ljworld and in Lawrence SITE_ID = 2
, then SITE_ID
variable Is set to be explicitly set in ljworld / settings.py
and Lawrence / Settings.py
?
How do you run ljworld or dev servers of Lawrence?
Update:
I have used two sites with the content shared above. If there are any sites that are sharing the same content , Then what should be done? Do I really need different Django projects on n different servers, all connected to the same database server?
In addition, if I need to make changes in settings.py which will affect all those web sites, then each file will be very hard to change manually.
No, there is no app on each site of itself; Each site has itself an project to share the entire idea with a separate (fully or partially) shared content, so you may have a structure such as:
ljworld / manage.py settings.py urls.py ljworld_specific_app1 / ... Lawrence / manage.py settings.py urls.py Lawrence_space_app 1 /
You Generally, the services of two web servers will be used to serve - although generally they refer only to the same DB server Nge Naturally you can also find apps that are shared between the two projects - just do not put them somewhere in Pithonpat server.
Edit:
"Two web servers" definitely do not mean that two physically different The server may well be two virtual hosts running under the same web server frequency - heck, you can also map two projects for two separate directories under the same virtual host.
For shared settings, you can use it to have a global_product module for shared apps in which the sharing settings are available anywhere on the Python pane and import it from each setting.
And if you really want some laugh, then maybe you can also leave all the different projects, use only one and create a middleware that changes the settings on the fly. But I would advise against it.
Comments
Post a Comment