If you want to update your Django app, after you make some changes on your local computer, you have to follow these simple steps.
First, create a new branch for your GitHub repository
git checkout -b new-branch-name
make changes and stage them
git add .
Commit the Changes
git commit -m "Your descriptive commit message"
Push the branch to GitHub
git push origin new-branch-name
On your PythonAnywhere account, go to Web Menu.
Open your Web menu.
Under Virtualenv: section, choose "Start a console in this virtualenv" option.
On the console, fetch and switch to the branch you want
git fetch origin git checkout new-branch-name
Pull the latest changes
git pull origin new-branch-name
Open pgAdmin app. Select the database you want to backup.
Right click the database and choose "Backup".
Now add a backup name with .sql file extension. Choose a format as "Plain".
The backup file will be stored in the Documents folder.
Step 4: Update the LocalPostgreSQL Database Changes to the online One
Upload the PostgreSQL database to the webapp folder.
In Terminal, use the following command to upload the folder to the current Django App PythonAnywhere PostgreSQL database.
psql -h <hostname> -p <port-no> -U <username> -d <database_name> -f <backup_file.sql>
Enter the user password, when it asked. This will overwrite existing data in tables if table names match.
© 2024 Webapptiv. All rights reserved.