Quickstart – Installation

Welcome to the REST-API-PYTHON-demo Quickstart guide! This section walks you through getting the project up and running on your local machine in just a few simple steps.


📑 Index

  1. Prerequisites
  2. Clone the Repository
  3. Set Up a Virtual Environment (Recommended)
  4. Install Dependencies
  5. Verify Installation

1. Prerequisites

Before you begin, ensure you have the following installed:

  • Git (for cloning the repo)
  • Python 3.6+
  • pip (Python package manager)

Optionally, it’s highly recommended to use a virtual environment to isolate project dependencies.


2. Clone the Repository

Start by cloning the demo API from GitHub:

git clone https://github.com/magarrent/REST-API-PYTHON-demo.git

Then navigate into the project’s Python folder:

cd REST-API-PYTHON-demo/PYTHON

A virtual environment helps avoid version conflicts:

# Create a venv named 'venv'
python3 -m venv venv

# macOS/Linux
source venv/bin/activate

# Windows (PowerShell)
.\venv\Scripts\Activate.ps1

Once activated, your shell prompt will be prefixed with (venv).


4. Install Dependencies

All required Python packages are listed in requirements.txt. Install them with:

pip install -r requirements.txt

What’s inside requirements.txt?

The file pins the core libraries used throughout the project:

Package Purpose
Flask Lightweight web framework
Flask-RESTful Extension for building REST APIs
Flask-JWT JSON Web Token authentication
Flask-SQLAlchemy ORM support for Flask (database models & sessions)
Werkzeug WSGI utilities & security helpers (e.g., safe_str_cmp)

5. Verify Installation

  1. Ensure the virtual environment is active (see step 3).

  2. Run the application:

    python app.py
    
  3. You should see output similar to:

    * Serving Flask app "app"
    * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
    
  4. Open your browser or API client (e.g., Postman) to http://localhost:5000 and test any endpoint.


Congratulations! 🎉 You’ve successfully installed and launched the demo RESTful API. Proceed to the Usage section to explore available endpoints, authentication workflows, and data models.