Django Boilerplate

screenshot of Django Boilerplate

Django Boilerplate

Django boilerplate for Django 1.11.XXX and Python 3 with a login system and Rest Framework integrated

Overview:

The Django Docker Boilerplate is a template for building Django Rest Framework projects with additional features such as Redis, RabbitMQ, and Celery. The template is no longer supported, as it has been updated to a second version. It comes with a variety of plugins for different types of projects and allows for customization by changing the framework used. The template provides a basic login and homepage, but additional views and HTML files need to be created. The template now supports Django Channels.

Features:

  • Integration with Redis, RabbitMQ, and Celery for improved performance and task management.
  • Ability to customize the framework used by updating the references in the static and templates folders.
  • Comes with a variety of plugins for different project types, allowing for flexibility.
  • Supports Django Channels for real-time communication.

Installation:

To install the Django Docker Boilerplate, follow these steps:

  1. Use the following command to start a new project based on the template: django-admin startproject --template=https://github.com/tiagoarasilva/django-boilerplate/archive/master.zip --extension=py,md,html,txt,scss,sass project_name
  2. Replace "project_name" with the desired name for your project.
  3. Some views, such as registration or change password, require additional HTML files to be created. Simply place the HTML files in the appropriate directory.
  4. The template includes Docker support. If using Docker, update the "project_name" in your Docker file to match the name given to the project in the previous step.
  5. Run the following commands:
    • docker volume create --name=project_name_db_data
    • docker-compose up (downloads necessary resources for building Docker containers)
    • docker-compose exec project_name bash (go inside the container)
    • make run (start the server within the Docker container)
    • make shell (start the shell_plus)
  6. Optionally, you can create aliases in your local machine's bash_profile/bashrc/profile to automate some of the previous instructions.

To run your project for the first time:

  1. Inside the Docker container, run make migrate or python project_name/manage.py migrate to run the first migration.
  2. Run python project_name/manage.py createsuperuser to create a super user.
    • By default, a "User Admin" is created with "Admin" as the first and last name. This can be changed in accounts/management/commands/createsuperuser.py.

To run tests:

  • If migrations were run before and you need to reconstruct the DB schema, run make unittests TESTONLY='profiles.tests.models_tests' or make unittests TESTONLY='profiles.tests.models_tests:ProfileUserTest.test_create_user' for a specific test.
  • If only running tests and the models weren't changed, run reusedb_unittests TESTONLY='profiles.tests.models_tests'.

Summary:

The Django Docker Boilerplate is a template for building Django Rest Framework projects with additional features such as Redis, RabbitMQ, and Celery. It provides flexibility by allowing customization of the framework used and comes with a variety of plugins for different project types. The template is no longer supported and has been updated to a second version. It now supports Django Channels for real-time communication. The installation process involves using Docker, creating necessary views and HTML files, and running commands to setup the project and run tests.