Activity 21: Python Anywhere Deployment

Activity 21: Python Anywhere Deployment

Step 1: Fork the Repository

  1. Go to the Keriderya API Repository.

  2. Click the "Fork" button on the top right corner. This will create a copy of the repository under your GitHub account.

Link:https://github.com/Xavierbaliw/keriderya-api

Step 2: Set Up a PythonAnywhere Account

Step 3: Open Bash Console

  1. Log in to your PythonAnywhere account.

  2. Navigate to the Consoles tab and add a new Bash console.

Step 4: Clone Your Forked Repository

In the Bash console, clone your repository using the following command

Step 5: Set Up a Database in MySQL Console

  1. Go to the Databases tab.

  2. Create a new MySQL database.

Step 6: Create a Virtual Environment

In the Bash console, navigate to your project directory and create a virtual environment:

Step 7: Activate the Virtual Environment

Step 8: Configure Environment Variables

Create a config.py file or configure your environment variables as needed.

Step 9: Edit config.py

Step 10: Run Database Migrations

python -m flask db upgrade

Step 11: Check MySQL Tables

You can check your MySQL tables using the MySQL Console to confirm successful migrations.

Step 12: Go to Web Tab

  1. Navigate to the Web tab on PythonAnywhere.

  2. Click on "Add a new web app"

Step 13: Create New Web App

  • Choose Flask.

  • Select Python 3.10.

  • Step 14: Path to Virtual Environment

    In the web app settings, set the path to your virtual environment

  • Step 15: Edit wsgi.py

    Edit the wsgi.py file to include your application:

  • Step 16: Reload Your Web App

    Go back to the Web tab and click on the Reload button.

    Step 17: Testing with Postman

    Use Postman to test your API endpoints.

    LINK: https://xavierbaliw.pythonanywhere.com/

  • Step 18: Add Dummy Data

    You can add dummy data to your database using SQL commands or a data seeding method defined in your application.

LINK : https://xavierbaliw.pythonanywhere.com/