Code Monkey home page Code Monkey logo

django-boilerplate's Introduction

django-boilerplate

Boilerplate to create Django project.

This boilerplate creates a simple Django project with a core app and some pre-defined settings.

The project contains:

  • Settings config
  • App Accounts
    • login
    • logout
    • signup

  • App CORE
    • Abstract models
  • App CRM
    • CRUD
    • Templates
  • App Expense
    • CRUD
    • Templates
    • Modal
    • htmx

CRM Model

Packages

Packages used in conjunction with Django.

Usage

This script run in Unix.

git clone https://github.com/rg3915/django-boilerplate.git /tmp/django-boilerplate
# Copy this file to your actual folder.
cp /tmp/django-boilerplate/boilerplatesimple.sh .

Update USERNAME to your username.

Type the following command. You can change the project name.

source boilerplatesimple.sh myproject

Alias

If yout want to use a alias.

alias djboilerplate='git clone https://github.com/rg3915/django-boilerplate.git /tmp/django-boilerplate;
cp /tmp/django-boilerplate/boilerplatesimple.sh .
printf "Type:\n`tput setaf 2`source boilerplatesimple.sh myproject\n"'

App CRM

CRM example.

python manage.py create_data
python manage.py runserver

App Expense

Example of a simple expense.

Exploring Boostrap modal and htmx.

New app

If create new app edit */apps.py.

# accounts/apps.py
# core/apps.py
# crm/apps.py
# expense/apps.py
name = 'PROJECT.<app name>'
# example
name = 'myproject.accounts'
name = 'myproject.core'
name = 'myproject.crm'
name = 'myproject.expense'

django-seed

To populate database with fake data, use django-seed and type

python manage.py seed crm expense --number=15

Base Models

The app core contains abstract models to use in other models.

management commands

The app core contains a management commands example.

$ python manage.py hello --help

usage: manage.py hello [-h] [--awards] ...

Print hello world.

optional arguments:
  -h, --help            show this help message and exit
  --awards, -a          Help of awards options.
$ python manage.py create_data --help

usage: manage.py create_data [-h] ...

Create data.

Graphic model Django with PyGraphViz

sudo apt-get install -y graphviz libgraphviz-dev pkg-config
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pygraphviz
pip uninstall pyparsing
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709
pip install pydot
pip install django-extensions

The next command generate the graphic of model.

python manage.py graph_models -e -g -l dot -o core.png core  # only app core
python manage.py graph_models -a -g -o models.png  # all

Screen

img/login

img/person_list

img/person_detail

img/modal

img/models_crm_expense.png

Folders

.
.
├── contrib
│   └── env_gen.py
├── manage.py
├── myproject
│   ├── asgi.py
│   ├── accounts
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── forms.py
│   │   ├── models.py
│   │   ├── templates
│   │   │   └── accounts
│   │   │       ├── login.html
│   │   │       └── signup.html
│   │   ├── tests.py
│   │   ├── urls.py
│   │   └── views.py
│   ├── core
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── management
│   │   │   └── commands
│   │   │       ├── create_data.py
│   │   │       ├── hello.py
│   │   │       └── __init__.py
│   │   ├── models.py
│   │   ├── static
│   │   │   ├── css
│   │   │   │   ├── form.css
│   │   │   │   ├── icons
│   │   │   │   │   └── simple-line-icons.min.css
│   │   │   │   ├── login.css
│   │   │   │   └── style.css
│   │   │   ├── fonts
│   │   │   │   ├── Simple-Line-Icons.eot
│   │   │   │   ├── Simple-Line-Icons.svg
│   │   │   │   ├── Simple-Line-Icons.ttf
│   │   │   │   ├── Simple-Line-Icons.woff
│   │   │   │   └── Simple-Line-Icons.woff2
│   │   │   └── img
│   │   │       └── django-logo-negative.png
│   │   ├── templates
│   │   │   ├── base.html
│   │   │   ├── base_login.html
│   │   │   ├── includes
│   │   │   │   ├── nav.html
│   │   │   │   └── pagination.html
│   │   │   └── index.html
│   │   ├── tests.py
│   │   ├── urls.py
│   │   └── views.py
│   ├── crm
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── forms.py
│   │   ├── mixins.py
│   │   ├── models.py
│   │   ├── templates
│   │   │   └── crm
│   │   │       ├── person_confirm_delete.html
│   │   │       ├── person_detail.html
│   │   │       ├── person_form.html
│   │   │       └── person_list.html
│   │   ├── tests.py
│   │   ├── urls.py
│   │   └── views.py
│   ├── expense
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── forms.py
│   │   ├── mixins.py
│   │   ├── models.py
│   │   ├── templates
│   │   │   └── expense
│   │   │       ├── expense_detail.html
│   │   │       ├── expense_form.html
│   │   │       ├── expense_list.html
│   │   │       ├── expense_result.html
│   │   │       ├── expense_table.html
│   │   │       ├── expense_update_form.html
│   │   │       └── includes
│   │   │           ├── add_modal.html
│   │   │           ├── detail_modal.html
│   │   │           └── update_modal.html
│   │   ├── tests.py
│   │   ├── urls.py
│   │   └── views.py
│   ├── settings.py
│   ├── urls.py
│   ├── utils
│   │   ├── progress_bar.py
│   │   └── utils.py
├── README.md
└── requirements.txt

Read

https://github.com/rg3915/django-auth-tutorial

https://github.com/rg3915/django-custom-login-email

https://github.com/rg3915/coreui-django-boilerplate-v2

django-boilerplate's People

Contributors

rg3915 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-boilerplate's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.