Skip to content

Latest commit

 

History

History
216 lines (151 loc) · 4.65 KB

File metadata and controls

216 lines (151 loc) · 4.65 KB

Getting Started

Welcome to The Inventory — an open-source REST API for inventory management built with Django and Wagtail.

This guide will help you install and run the backend API locally in about 10 minutes.

Prerequisites

Before you start, make sure you have:

Verify Prerequisites

python --version      # Should show Python 3.12+
git --version         # Should show git version
pip --version         # Should show pip version

Installation Steps

1. Clone the Repository

git clone https://github.com/Ndevu12/the_inventory.git
cd the_inventory

2. Create a Virtual Environment

A virtual environment isolates project dependencies from your system Python.

On macOS/Linux:

python -m venv venv
source venv/bin/activate

On Windows:

python -m venv venv
venv\Scripts\activate

You should see (venv) in your terminal prompt when activated.

3. Install Dependencies

pip install -r requirements.txt

This installs Django, Wagtail, Django REST Framework, and all other required packages.

4. Navigate to Backend Directory

cd src

All Django commands must be run from this directory.

5. Run Database Migrations

python manage.py migrate

This creates the SQLite database and sets up all tables.

6. Create a Superuser (Admin Account)

python manage.py createsuperuser

Follow the prompts to create your admin account:

  • Username: (choose a username)
  • Email: (your email)
  • Password: (choose a strong password)

7. (Optional) Seed Sample Data

To populate the database with sample data for testing:

python manage.py seed_database --clear --create-default

This creates:

  • A default tenant organization
  • Sample products, categories, and stock locations
  • Sample users and test data

8. Start the Development Server

python manage.py runserver

You should see output like:

Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Verify Installation

Access the Admin Interface

Open your browser and visit:

Login to Admin

Use the superuser credentials you created in step 6.

Test the API

Try this in your terminal:

curl http://localhost:8000/api/v1/

You should see a JSON response with available API endpoints.


Next Steps

For API Users

For Deployers

For Contributors

For Operators


Troubleshooting

Python Version Error

Error: Python 3.12+ required

Solution: Install Python 3.12 or later from python.org

Port Already in Use

Error: Address already in use

Solution: The default port 8000 is in use. Run on a different port:

python manage.py runserver 8001

Database Migration Error

Error: No such table

Solution: Run migrations again:

python manage.py migrate

Permission Denied (macOS/Linux)

Error: Permission denied

Solution: Make sure your virtual environment is activated:

source venv/bin/activate

More Issues?

See the Troubleshooting Guide for more help.


What's Next?


Need Help?

Happy coding! 🚀