This document provides instructions for setting up and running the Django REST API application. This API serves as the backend for Chickenbook application.
Before you begin, ensure you have the following installed on your system:
- Python 3.10 or higher
- pip (Python package manager, Python include pip) verify installation with command: pip --version
Follow these steps to set up the Django REST API application on your local development machine.
- Clone the Repository Clone the repository to your local machine using Git:
git clone https://github.com/jg-chickenbook/chickenbook-server.git
cd chickenbook-server
- Create and Activate a Virtual Environment For Unix/macOS:
python3 -m venv env
source env/bin/activate
For Windows:
python -m venv env
.\env\Scripts\activate
- Install Required Packages Install all required packages using pip:
pip install -r requirements.txt
- Apply Migrations Apply database migrations to set up your database schema:
python manage.py migrate
- Create an Admin User Create an admin user to access the Django admin interface:
python manage.py createsuperuser
Follow the prompts to set up your username, email, and password.
- Run the Development Server
Start the Django development server:
python manage.py runserver
The API will be available at http://localhost:8000. If you need run server on different port just specify port at the end of the command
Testing the API To test the API endpoints, you can use tools like Postman or curl. Here is an example curl command to test the API:
curl -X GET http://localhost:8000/api/accounts/test_token
Replace /api/endpoints with the actual endpoint you wish to test.
If you have any feedback, please file an issue in the GitHub repository or contact us on github.