Django Project Template screenshot

Django Project Template

Author Avatar Theme by Magnet cl
Updated: 14 Oct 2022
14 Stars

A project template for Django in python 3

Categories

Overview

The Django Project Template (DPT) is a project template for Django 2.2 in Python 3. It aims to solve common problems and provide useful features for Magnet projects. By starting your project with this template, you have a solid base to work from. The template is stored in a repository, which you can clone and customize for your own project.

Features

  • BaseModel: All models inherit from the BaseModel class, which provides common fields like ‘created_at’ and ‘updated_at’, as well as methods like ’to_json’ and ’to_dict.update’.
  • OrderableModel: This model allows for ordering of records in the database.
  • Custom App Template: The template includes a custom app template with pre-defined files and structure for creating new apps.
  • CRUD Views: The template includes CRUD views for the model in the custom app template.
  • URLs: The template includes a URLs file that maps the CRUD views.
  • Managers: The template includes a Managers file with a single QuerySet for the model.
  • Forms: The template includes a Forms file with a single Form for the model.
  • Admin: The template includes an Admin file with a single Admin for the model.
  • Templates: The template includes a templates folder with templates in .pug format for all CRUD views.

Installation

  1. Create a new repository for your Django project and clone it to your computer.
  2. Add the django-project-template GitHub repository as a remote repository:
    git remote add template git@github.com:magnet-cl/django-project-template.git
    
  3. Pull the code from the project template:
    git pull template master
    
  4. Configure project_name and server_git_url in ansible/group_vars/all.yaml file using a text editor:
    vim ansible/group_vars/all.yaml
    
  5. Push the code to your own repository:
    git push origin master
    
  6. Remove the LICENSE file if your new project does not have an MIT license.

Summary

The Django Project Template (DPT) is a useful starting point for Django projects. It provides common features and solves commonly encountered issues in Magnet projects. By using the template, developers can save time and effort in setting up their projects and focus more on building functionality specific to their project.