From 6a2435fe27b550dd112eac9061eb455cf910da61 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sat, 21 Oct 2023 12:28:49 -0300 Subject: Added README --- README.md | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cd9152 --- /dev/null +++ b/README.md @@ -0,0 +1,116 @@ +# Django Base App + +This is my Django starter base app. Nothing too fancy. + +## What does it includes? +- Django +- Django REST Framework +- django-extensions +- Docker & docker-compose with a Postgres DB +- GitlabCI / Github Actions +- Linting with: + + black + + isort + + flake8 + + pylint + + mypy + + pytest +- pre-commit configuration +- Makefile +- More? + +## How do I use this? + +Easy. + +First, clone the repo: +``` sh +git clone git@gitlab.com:rogs/base_django.git --depth 1 +cd +``` + +Then, remove the Git folder, create a new git repo and add the remote: + +``` sh +rm -rf .git +git init +git remote add origin +``` + +Finally, install the virtualenv: + +``` sh +virtualenv .venv +source .venv/bin/activate +(.venv) pip install -r requirements.txt +``` + +## Available commands + +The Makefile simplifies common development tasks for Django projects using Docker and Docker Compose. It provides shortcuts to build images, run migrations, start the development environment, and more. + +### Base + +- `build:` + +Build Docker images using `docker-compose`. + +- `makemigrations:` + +Create new database migrations for your Django project. + +- `migrate:` + +Run database migrations to apply changes to the database schema. + +- `createsu:` + +Create a superuser for your Django application. + +- `init:` + +Combine `build` and `migrate` to set up the development environment. + +### Development: + +- `up:` + +Start the development environment with `docker-compose`. + +- `django-manage:` + +A flexible target for running Django management commands. Use it like this: + + make django-manage command= + +For example, to run `python manage.py test`, you would use: + + make django-manage command=test + +- `shell:` + +Start a Django shell using `shell_plus`. This target provides an interactive Python environment for your project. + +- `full:` + +A combination of `init` and `up`. Useful for quickly setting up and starting the development environment. + +- `kill:` + +Stop and remove containers started with `docker-compose`. + +- `cleanup:` + +This target cleans up containers and removes associated volumes. + +- `test:` + +Use this target to run your Django tests. It accepts a `target` parameter to specify which tests to run. + + make test target= + +Replace `` with the specific tests you want to run. + +- `bash:` + +This target starts a Bash shell inside the Django app container, allowing you to access the container's shell. -- cgit v1.2.3