Skip to content

Lorygold/DjangifyLab

Repository files navigation

DjangifyLab

Django App Explorer. Test any Django app package with zero setup. Just plug, migrate, run.

A clean and isolated sandbox to test Django app packages before integrating it into a real-world or production Django project.

Why you need DjangifyLab

When you develop a Django reusable app — for microservices integrations (such as authentication, alerting, monitoring...) or for entire standalone apps — you often test it inside an existing Django project. However, this approach can hide critical issues:

  • The host project may already contain dependencies that your app requires, masking missing packages from install_requires in the setup.cfg Django app file.
  • Your local environment may be dirty or pre-configured, leading to false assumptions that your app works in isolation.
  • Without sandboxing, it's easy to forget required dependencies or overlook configuration steps when packaging the app.
  • In a production deployment, conflicting versions or missing environment variables can cause unexpected runtime errors.

DjangifyLab provides:

  • A clean Django project where you can install and test your .tar.gz reusable app.
  • Full control over environment variables and configuration via .env.
  • A consistent way to simulate deployment with docker containers.
  • A place to define external configuration files (e.g. JSON, YAML) required by your app.

This helps ensure your reusable app is self-contained, fully functional, and truly reusable in any Django environment.

Quickstart

  1. DjangifyLab first setup Follow these steps to install setup DjangifyLab (just for the first time):
  • Clone the repository:
git clone https://github.com/Lorygold/DjangifyLab.git
cd DjangifyLab
  • Create and activate the virtual environment:
python -m venv djangifylab-venv
source djangifylab-venv/bin/activate
  • Install the DjangifyLab requirements:
pip install -r requirements.txt
  • Create your admin Django superuser to access to the Django admin page (store your credentials):
python manage.py createsuperuser
  1. Install your Django App to test
source djangifylab-venv/bin/activate
python install_app.py example-apps/your_app.tar.gz

Then, manually add your app to INSTALLED_APPS in djangifylab_project/settings.py:

INSTALLED_APPS = [
    ...
    "your_app_name",
]
  1. (Optional) Edit the .env file for Custom Environment Variables If your app requires specific environment variables, edit the .env file in the project root:

These will be loaded automatically by the Django settings.

  1. (Optional) Add App-Specific Configuration Files

If your app depends on external config files (e.g., JSON, YAML), place them inside DjangifyLab/config_files/your_app_name/

And in the .env file: MY_APP_CONFIG_PATH=/full/path/to/DjangifyLab/config_files/your_app_name

  1. (Optional) Start Required Services with Docker

If your app relies on services like PostgreSQL, MongoDB, Redis, etc., you can start them via Docker:

docker compose -f docker/docker-compose.database.yml up -d postgres
  1. Run the app and Launch your management commands

2b. Test your Django app - if it's a single version app - in the container:

> docker compose -f docker-compose.override.yml -f docker-compose.database.yml up --build app-installer

2c. Test your Django app - if it's an upgrade version test - with the single command line:

> python entrypoint.py --mode=upgrade --previous_version=example-apps/packages/your_app_name_prev_version.tar.gz --new_version=example-apps/packages/your_app_name_new_version.tar.gz --fixture=example-apps/fixtures/buffalogs_complete_fixtures.json

2d. Test your Django app - if it's an upgrade version test - in the container:

> docker compose -f docker-compose.override.yml -f docker-compose.database.yml up --build upgrade-runner

Your app is now ready to be tested in a clean, production-like environment.

Example

The BuffaLogs Django Reusable App has been used to test this project, so it's possibile to check the config file presence (in the app_config_giles/buffalogs/ folder) and the app itself with fixture (in the example-apps)

Licence

This project is protected by the Apache Licence 2.0.

About

Django App Explorer. Test any Django app package with zero setup. Just plug, migrate, run.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors