DjangoDefault

Django Default

banner

Django Default is a Django project structure generator that simplifies the process of setting up new Django projects. It automates the cloning of a predefined Django project structure from a GitHub repository, enabling developers to start their projects with a solid foundation.

Features

Installation

Install Django Default using pip:

pip install django-default

Usage

To generate a new Django project structure, execute the following command:

shinzo

This command clones the predefined Django project structure into your current working directory.

Configuration

After generating your project structure, configure it by setting up the database and adjusting the settings in settings.py to match your environment. Ensure to include the third-party apps listed in core/config/apps.py:

Development

To contribute to Django Default, set up a development environment by cloning the project and installing its dependencies. Run tests to ensure your changes don’t break existing functionality and follow the project’s contribution guidelines when submitting pull requests.

API Documentation

If your project uses Django REST Framework, use drf_spectacular to auto-generate API documentation. Document your API endpoints, including information on request methods, parameters, and example responses.

License

Django Default is released under the MIT License. See the LICENSE file in the project repository for more information.

Acknowledgments

Contact

Please contact Jahongir Hakimjonov with any questions or concerns regarding this project.

pypi

Management Commands Documentation

This document provides an overview and usage instructions for custom management commands included in the Django project.

Commands

createadmin

makeapp

nginx

secret_key

Project Dependencies and Tools

This project utilizes a combination of powerful tools and technologies to manage background tasks, message queuing, and real-time monitoring. Below is an overview of the key components:

Celery

Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation but supports scheduling as well. The execution units, called tasks, are executed concurrently on one or more worker nodes using multiprocessing, Eventlet, or gevent. Celery is used in this project for handling background tasks efficiently.

Key Components:

RabbitMQ

RabbitMQ is an open-source message broker software that originally implemented the Advanced Message Queuing Protocol (AMQP). It facilitates the efficient delivery of messages in complex routing scenarios and ensures that messages are processed only once, in the order they are sent. In this project, RabbitMQ is used as the message broker for Celery, managing the queue of tasks to be processed by the workers.

Redis

Redis is an in-memory data structure store, used as a database, cache, and message broker. In this project, Redis is used in two main roles:

Flower

Flower is a web-based tool for monitoring and administrating Celery clusters. It provides detailed real-time information about task queues, workers, and tasks, with the ability to control them directly through the web interface. Flower is an essential tool for managing and troubleshooting Celery tasks and workers in this project.


To set up these components for your development environment, refer to the respective official documentation for installation and configuration guidelines.

General Information

These commands are designed to streamline common tasks in Django development and deployment. Ensure you have the necessary permissions and environment setup before running these commands.

Pre-commit for Code Quality Assurance

Pre-commit is an essential tool in modern development workflows, ensuring that code committed to the repository adheres to defined quality standards. It automates the process of checking code for common issues before it is committed, helping to maintain a clean and error-free codebase.

Features and Benefits:

Setting Up Pre-commit in Your Project:

  1. Installation: Install pre-commit using pip:
    pip install pre-commit
    
  2. Configuration: Create a .pre-commit-config.yaml file in your project root directory. Define the hooks you want to use, as shown in the project’s current configuration.
  3. Install Git Hook Scripts: Run the following command to set up pre-commit with your git hooks:
    pre-commit install
    

    This step ensures that pre-commit runs automatically on every commit attempt.

  4. Optional: Commit Message Hooks: For projects requiring commit message standards, pre-commit can enforce this through commit message hooks:
    pre-commit install --hook-type commit-msg
    
  5. Manual Run: To manually run pre-commit on all files in the project, use:
    pre-commit run --all-files
    

    This is useful for initial setup or periodic checks across the entire codebase.

Example Configuration:

The project’s .pre-commit-config.yaml includes hooks for checking JSON, TOML, and ensuring no merge conflicts, among others. It also utilizes ruff for fast Python linting and formatting, demonstrating the flexibility and power of pre-commit in maintaining code quality.

For detailed information and advanced configurations, refer to the official pre-commit documentation.

Development

Pre-commit

Before adding any source code, it is recommended to have pre-commit installed on your local computer to check for all potential issues when comitting the code.

black . # Format the code
pip install pre-commit
pre-commit install
pre-commit install --hook-type commit-msg
pre-commit run --all-files # Check if everything is okay