This Django app helps restaurant employees easily manage ingredient inventory, create menus and recipes with prices, track purchases, and stay informed about low stock levels.
Ensure the following are installed on your system:
- Git
- Python 3.10 or higher (tested on 3.13.1)
python --version
- Clone this repository and navigate into the project directory.
git clone <Github-link> && cd <project-directory>
- Create and activate a virtual environment:
# Create the virtual environment
python3 -m venv .venv
# Activate the virtual environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activate
- Install dependencies
pip install -r requirements.txt
- Prepare and apply migrations:
python3 manage.py makemigrations
python3 manage.py migrate
- Create a superuser for accessing the admin interface by running the following command and following the instructions:
python3 manage.py createsuperuser
Start the server locally:
python3 manage.py runserver
Access the admin interface at: http://127.0.0.1:8000/admin/
Run unit tests to verify the functionality:
python3 manage.py test
This project uses ruff for linting and formatting.
# Check for linting issues in the current directory:
ruff check .
# Automatically fix linting issues:
ruff check --fix
# Format all files in the current directory:
ruff format .
This project uses isort to sort and organize Python imports for better readability and consistency.
# Check for unsorted imports in the current directory:
isort . --check
# Automatically sort and organize imports:
isort .
# Preview changes without applying them:
isort . --diff
This repository uses GitHub Actions for automation.
- Ruff Linter: Ensures that the code adheres to linting standards.
- isort: Ensures organized and sorted imports.
- unittests: Ensures that the code is tested.
- On every commit push to any branch.
The runscript command lets you run an arbitrary set of python commands within the Django context. It offers the same usability and functionality as running a set of commands in shell
.
The orm.py
script demonstrates Django's ORM interaction with the database and logs raw SQL queries when LOGGING_ENABLED = True
, aiding debugging and performance analysis.
python manage.py runscript orm
You can generate a visual diagram of your models using Django Extensions and Graphviz.
Install the necessary libraries:
pip install django-extensions
brew install graphviz
Add django-extensions
to INSTALLED_APPS
in settings.py
.
INSTALLED_APPS = [
...,
'django_extensions',
]
Add the following to settings.py
to enable diagram generation:
GRAPH_MODELS = {
'all_applications': True,
'group_models': True,
}
Generate the model diagram as a .dot file:
python3 manage.py graph_models -a --dot -o restaurant_models.dot
Convert the .dot file to an image:
dot -Tpng base_models.dot -o restaurant_models.png
For further information on the model diagram you can read the the django-extensions documentation.