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.
Install Django Default using pip:
pip install django-default
To generate a new Django project structure, execute the following command:
bankai
This command clones the predefined Django project structure into your current working directory.
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
:
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.
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.
Django Default is released under the MIT License. See the LICENSE file in the project repository for more information.
Please contact Jahongir Hakimjonov with any questions or concerns regarding this project.
This document provides an overview and usage instructions for custom management commands included in the Django project.
python manage.py createadmin
apps
directory. It also modifies the app’s apps.py
to correctly reference the app’s location and removes unnecessary files.python manage.py makeapp <app_name>
<app_name>
: The name of the app you want to create.python manage.py nginx
python manage.py secret_key
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 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.
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 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 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.
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 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.
pip install pre-commit
.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.pre-commit install
This step ensures that pre-commit runs automatically on every commit attempt.
pre-commit install --hook-type commit-msg
pre-commit run --all-files
This is useful for initial setup or periodic checks across the entire codebase.
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.
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