Migrating Your Existing Database to PostgreSQL On Your VPS
- Dump existing data on local system :
(local_project_env) $ python manage.py dumpdata > dump.json
- Move the dump.json file from your local system to VPS using either github or secure copy(scp).
- Run the python shell and remove contentType data :
(Note: Run the following commands on server’s terminal (ssh))
(project_env) $ python manage.py shell >>> from django.contrib.contenttypes.models import ContentType >>> ContentType.objects.all().delete() >>> quit
- Load the dump.json file to your database:
(project_env) $ python manage.py loaddata dump.json
Hosting Your Django Website on a CentOS VPS
Hosting any website/web application on a live server can sometimes become difficult if proper steps are not taken while deploying it. There are mainly 3 different types of hosting:
- Shared Hosting – Usually used for small (single page) websites with limited traffic.
- VPS Hosting – VPS ( Virtual Private Server ) hosting is used for websites with good amount of content and medium to high traffic.
- Dedicated Hosting – This hosting is generally used for large business websites with a lot of content and high traffic.
In this article, we will be discussing mainly about VPS hosting.