How to Download Files from Pythonanywhere for Backup?
PythonAnywhere is one of the most popular Django hosting server platforms where you can host and run your Django website.
In an earlier tutorial, I have explained to you how to host and run your Django website on PythonAnywhere. In this tutorial, I am going to explain to you the steps to take the Django website backup.
We all know how crucial it is to take the backup regularly. Taking backup regularly can be very useful to restore your website in case any mishap happens.
You can take the backup of your Django project manually. By doing it manually, you don’t need to pay anything extra (Completely FREE).
Steps to Take Backup on PythonAnywhere Manually
These steps include simple commands. Let’s follow them one by one.
Step 1. Create a Backup (Zip)
- Login to your PythonAnywhere account in the web browser and open the dashboard.
- Open PythonAnywhere bash console.
- By default, the current directory in bash will be your project directory. Go to the parent directory (go up by one).
(project_name.pythonanywhere.com) 17:28 ~ $ cd ../ (project_name.pythonanywhere.com) 17:28 ~ $ pwd /home/account (project_name.pythonanywhere.com) 17:28 ~ $ ls README.txt project_name.pythonanywhere.com static (project_name.pythonanywhere.com) 17:28 ~ $
These are just basic Linux commands.
- Here your project directory is
project_name.pythonanywhere.com
. Create the zip bundle using below command.
$ zip -r backup_file_name project_name.pythonanywhere.com
It will take some time to create the zip bundle based on your project directory size. Once it is done, you can download the bundle.
Step 2. How to download Backup files from PythonAnywhere?
- Go to the
Files
. - You will see the backup zip file. Click on the download button icon.
It will start downloading the backup file on your local system.
Step 3. Unzip and check the backup
Once you download files from pythonanywhere, you have to verify them.
You can unzip or extract the downloaded zip bundle to see all the backup files. Make sure it has all your project files including the database file. Keep this zip file for future use.
With some sort of Python scripting, you can also automate these steps for backing up the project and database files.
I hope you find these steps to take a backup on PythonAnywhere manually simple and easy. If you find any difficulties taking backup, let me know in the comment below.