Separating out database server and Web server can increase resource efficiency. Server will not fight for resource using. Here we use mysql server to demo..
We modify MySQL setting that let it can be remote connected. Login in mysql server by mysql -u root -p your password, and
use mysql
update User set Host='%' where User='root';
select Host,User from user;
FLUSH PRIBILEGES;
Then unbind mysql in local machine
sudo vi /etc/mysql/my.cnf
#bind-address=127.0.01
sudo /etc/init.d/mysql restart
Change setting in Django
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test_data',
'USER': 'root',
'PASSWORD': your password,
'HOST': mysql server IP, #ex:172.23.115.187
'PORT': '3306',
}
}
Restart apache,you will find Django connect remote mysql server,BINGO!