This is a boilerplate project for Django, designed to help you get started quickly with a standard setup. It includes configurations for Poetry, PostgreSQL, and various Django apps and middleware.
- Python 3.8+
- Poetry
- PostgreSQL
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
poetry install
-
Set up environment variables: Create a
.env
file in the root directory and add the following variables:POSTGRES_NAME=<your-database-name> POSTGRES_USER=<your-database-user> POSTGRES_PASSWORD=<your-database-password> POSTGRES_HOST=localhost POSTGRES_PORT=5432 ALLOWED_HOSTS=* CSRF_TRUSTED_ORIGINS=
-
Apply database migrations:
poetry run python src/manage.py migrate
-
Create a superuser:
poetry run python src/manage.py createsuperuser
-
Run the development server:
poetry run python src/manage.py runserver
-
Run tests:
poetry run python src/manage.py test
-
Run linters:
poetry run flake8 src/
This project includes a Makefile
for common tasks:
make install
: Install dependenciesmake runserver
: Run the Django development servermake migrate
: Apply database migrationsmake make-migration
: Create a migrationmake dump-data
: Dump datamake create-superuser
: Create a superusermake db-shell
: Run the Django database shellmake shell
: Run the Django shellmake show-urls
: Show all URLsmake test
: Run testsmake lint
: Run lintersmake collect-static
: Collect static filesmake make-messages
: Create messagesmake compile-messages
: Compile messages
This project includes Docker support with the following commands:
make build
: Build the Docker imagemake build-local
: Build the Docker image using the local Dockerfilemake up
: Start the Docker containersmake up-force-build
: Start the Docker containers with a forced buildmake down
: Stop the Docker containers
├── Dockerfile
├── Makefile
├── README.md
├── config.example.env
├── docker-compose.yaml
├── poetry.lock
├── pyproject.toml
└── src
├── core
│ ├── __init__.py
│ ├── asgi.py
│ ├── env.py
│ ├── settings
│ │ ├── __init__.py
│ │ ├── django
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── local.py
│ │ │ ├── production.py
│ │ │ └── test.py
│ │ └── third_parties
│ │ ├── __init__.py
│ │ ├── drf.py
│ │ └── jwt.py
│ ├── urls.py
│ └── wsgi.py
└── manage.py
This project is licensed under the MIT License..