1👍
you can have multiple setting file for example develop.py and production.py
steps:
- create a settings folder inside the project
- Add all of the settings file to that folder
- while running server
./manage.py runserver -- settings=project_name.settings.required_settingfile
for example:
./manage.py runserver --settings=myproject.settings.develop
1👍
To serve multiple sites from the same Django instance you do not need multilple settings.py files.
A simple method is to omit the SITE_ID
setting from the Sites framework. Then include the Sites framework middleware:
'django.contrib.sites.middleware.CurrentSiteMiddleware'
This automatically passes a request
object to Site.objects.get_current()
on every request. It also allows your Django application to detect the current site via request.site
.
You would need to make sure to setup multilple virtual hosts using your NGINX or apache instance to route traffic from each site to your server.
- [Answered ]-Django redirecting from one view to another
- [Answered ]-Display Word Count in Blog Post with Wagtail
- [Answered ]-How to iterate over json object in python containing dictionary and list
- [Answered ]-Using network_mode='host' in docker-compose break run: host type networking can't be used with links
Source:stackexchange.com