A Django starter template with a sound foundation.

Overview

SOS Django Template

License Version Python Version Django Version

SOS Django Tempalate is a Django starter template that has opinionated and good solutions while starting your new Django project.

Django is a batteries-included backend framework. While it comes with a good starting template, this boilerplate is not usually enough for developing your projects further. So, you will often find yourself installing 3rd party packages, configuring them and structuring your project according to these 3rd party solutions, which is a waste of time. Instead, SOS Django Template starts you from opinionated but sensible defaults.

You can refer to the documentation in order to start using it.

Environment

SOS Django Template requires Python 3.7+, Django 2.2+ and Poetry to be installed on your system.

This template separates production and development settings, which are under different project.settings.development and project.settings production modules.

It comes with many dependencies ready to use, such as black, flake8, isort, pytest, Django Rest Framework, Celery etc.

How to Use

You can see how to use it here. A quick start would be:

# start a project named PROJECT_NAME
django-admin startproject PROJECT_NAME --template https://github.com/erayerdin/sos-django-template/archive/master.zip

# go to project root
cd PROJECT_NAME

# install system dependencies
bash ubuntu20.requirements.bash

# change project info
xdg-open pyproject.toml
xdg-open LICENSE.txt

# initialize poetry
poetry shell

# install deps
poetry install
# --no-dev flag to install only prod deps

# add pre-commit hooks, optional, recommended
pre-commit install

# change .env
mv .env.example .env  # rename
xdg-open .env  # edit

Documentation

This repository has a Wiki section so you can use it to get further information as to how to install and use SOS Django Template and tips and tricks.

Comments
  • mix command

    mix command

    See #50.

    mix command will be a command to compile mix assets.

    • Automatically collects apps with Laravel Mix supports.
    • --watch flag to keep watching asset changes.
    • APPNAME option to especially build a specific app's assets. If not provided, all will be build.
    • --list flag to only list apps with Laravel Mix support.
    enhancement command 
    opened by erayerdin 1
  • Laravel Mix Support

    Laravel Mix Support

    This issue, if closed, closes #7.

    Laravel Mix is a great solution that solves %80 of the use case.

    SPA is not needed for many projects. VueJS is a good solution for integrating AJAX to some parts of web page, e.g. a search bar or a list with pagination.

    To Do

    • [ ] createapp command to start an app with Laravel Mix with its gitignore
    • [ ] mix command for compiling mix assets
    • [ ] serve command to watch mix assets and run Django server in parallel
    enhancement 
    opened by erayerdin 1
  • A Better Way for System Requirements

    A Better Way for System Requirements

    Some distributions may distribute older versions of specific packages for the sake of consistency but you might need that package's official LTS for your development workflow. I've come across a situation that Ubuntu 20.04 distributing Node 10 while Node's official LTS is 14. It caused VueJS to not compile since it requires at least 12.

    That's why <SYSTEMNAME>.requirements.txt is not a good idea. Instead, we can provide a shell script, automagically installing the dependencies from dedicated sources.

    bug enhancement 
    opened by erayerdin 1
  • Black Fails

    Black Fails

    Black fails, see the output:

    [WARNING] Unstaged files detected.
    [INFO] Stashing unstaged files to /home/erayerdin/.cache/pre-commit/patch1563987583.
    Trim Trailing Whitespace.................................................Failed
    hookid: trailing-whitespace
    
    Files were modified by this hook. Additional output:
    
    Fixing LICENSE.txt
    
    Fix End of Files.........................................................Failed
    hookid: end-of-file-fixer
    
    Files were modified by this hook. Additional output:
    
    Fixing requirements.txt
    Fixing LICENSE.txt
    Fixing sozluk/architecture.drawio
    
    Check Yaml...............................................................Passed
    Check for added large files..............................................Passed
    black....................................................................Failed
    hookid: black
    
    Files were modified by this hook. Additional output:
    
    reformatted /foo/apps.py
    All done! ✨ 🍰 ✨
    1 file reformatted, 18 files left unchanged.
    
    seed isort known_third_party.............................................Passed
    isort....................................................................Passed
    [WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
    [INFO] Restored changes from /home/erayerdin/.cache/pre-commit/patch1563987583.
    
    bug wontfix 
    opened by erayerdin 1
  • v0.6.5

    v0.6.5

    Added

    • pytest-factoryboy dev dep (closes #47)
    • core_user and core_user_factory fixtures
    • pytest-cov dev dep
    • DJANGO_STATIC_URL and DJANGO_STATIC_ROOT env vars (closes #54)

    Changed

    • Fixed DJANGO_USE_L10N variable (closes #55)
    • ubuntu.requirements.txt is now a bash script named ubuntu20.requirements.bash (closes #49)
    • Migrated isort and pytest to pyproject.toml (closes #48)
    bug enhancement 
    opened by erayerdin 0
  • USE_L10N Not Present

    USE_L10N Not Present

    https://github.com/erayerdin/sos-django-template/blob/943749530a4db6f4da258eec823ebdeb01000c81/project/settings/defaults.py#L112

    This line should be USE_L10N.

    bug 
    opened by erayerdin 0
  • Static Environment Variables

    Static Environment Variables

    A couple of environment variables to set settings related to static files.

    • DJANGO_STATIC_URL to set STATIC_URL environment variable, defaults to /static/.
    • DJANGO_STATIC_ROOT to set STATIC_ROOT environment variable. Default is computational and will result it django subdirectory of system's temp directory.
    enhancement 
    opened by erayerdin 0
  • Migrate to pyproject.toml

    Migrate to pyproject.toml

    pyproject.toml is the new standard to define building process.

    List of Things to Migrate

    enhancement 
    opened by erayerdin 0
  • 0.6.0

    0.6.0

    Added

    • Poetry Support (closes #40)
    • Core App (closes #34)
    • Timestamp models (closes #44)
    • CoreUser model (closes #35)
    • VSCode ignores
    • Not Implemented View (closes #37)
    • Django Extensions (closes #17)

    Removed

    • Travis
    bug enhancement 
    opened by erayerdin 0
  • Setup CLI Util

    Setup CLI Util

    Setting up the project could be much more easier. We need a setup cli. Let sos be cli util, then:

    sos new NAME
    sos new NAME --lib
    

    It could also provide interactive setup.

    enhancement 
    opened by erayerdin 0
  • serve command

    serve command

    See #50.

    serve command will be an alternative to runserver command. It will watch Laravel Mix and run Django server in parallel and collectstatic before running Django server.

    • Runs mix watch and runserver in parallel.
    • Cleans collected static files on kill.
    • --no-watch to not watch mix assets.
    • --no-collect to not collect static files.
    • --no-clean to not clean static files on kill.
    enhancement command 
    opened by erayerdin 0
  • createapp command

    createapp command

    See #50.

    The provided modules are sometimes needed and sometimes not.

    • Sometimes, apps are created for SRP, which means they are created to isolate a functionality in an app. For instance, a project might have an ajax app for providing JSON endpoints to bring dynamism to a web page or a rest app to isolate REST endpoints.
    • Sometimes, apps are created as an extension. For instance, if a project has a different text formatting specification (like BBCode), it is better to isolate it into an app.
    • Sometimes, apps are created to isolate a part of whole project. Let's say we have a web app with a homepage, a forum, a QA platform and a messaging platform. We would create separate apps for each.

    So, adding models, views, tests and not including urls module is not always desirable. We can, however, provide a command that can create an app interactively, asking what part exactly a developer needs.

    createapp will be a command in core app. It is an alternative to startapp command but different in behavior.

    Interactivity

    Upon python3 manage.py createapp, an interactive session will start. It is represented in order in the table below.

    Note

    In the table below, a module is a single py file while package is a directory with __init__.py in it.

    | Condition | Order | Question | Answer Type | Default Answer | Description | |-|-|-|-|-|-| | - | 1 | Would you like to have models in your app? | y/n/Y/N | y | 1. Creates models module.
    2. Adds # noqa comment at the end of models import.
    3. Adds a # TODO remove noqa comment above import.
    4. Adds explanation as to factories and drawio files. | | If y to 1 | 2 | Would you like to have factories in your app? | y/n/Y/N | y | 1. Creates factories module.
    2. Adds appname.factories to conftest.py at root.
    3. Adds explanation as to how to write factories. | | If y to 1 | 3 | Would you like to create arch.drawio file? | y/n/Y/N | n | Creates arch.drawio file. | | - | 4 | Would you like to have views in your app? | y/n/Y/N | y | Creates views package. | | If y to 4 | 5 | Would you like to have urls in your app? | y/n/Y/N | y | 1. Creates urls module.\n
    2. Adds app_name variable to urls module so we can have namepsaces on urls.
    3. Adds urlpatterns list.
    4. Imports path and adds # noqa comment at the end.
    5. Adds appname.urls to projects.url module. | | If y to 5 | 6 | What should be the root URL for your app? | text | empty | If left empty, attaches url to the root url. | | - | 7 | Would you like admin integration for your app? | y/n/Y/N | n | 1. Creates admin module.
    2. Imports admin and adds # noqa to the end. | | If y to 4 | 8 | Would you like Laravel Mix support? | y/n/Y/N | n | Sets up Laravel Mix for the app. |

    Gitignore

    A .gitignore should be present at the root of each app so that it won't include unwanted files on commit.

    enhancement command 
    opened by erayerdin 0
  • Black Formats Migrations

    Black Formats Migrations

    I don't really know it is really necessary to ignore migration files from Black. I will add some thesis and antithesis below, which I will add to in time.

    Leaving migrations as is, to me, sounds better. That's mainly because migrations are generated by computer. On the other hand, developers might edit migrations by hand and they might desire formatting functionality then.

    bug 
    opened by erayerdin 2
Releases(v0.7.0)
  • v0.7.0(Mar 3, 2022)

  • v0.6.6(Oct 4, 2021)

  • v0.6.5(Apr 26, 2021)

    Added

    • pytest-factoryboy dev dep (closes #47)
    • core_user and core_user_factory fixtures
    • pytest-cov dev dep
    • DJANGO_STATIC_URL and DJANGO_STATIC_ROOT env vars (closes #54)

    Changed

    • Fixed DJANGO_USE_L10N variable (closes #55)
    • ubuntu.requirements.txt is now a bash script named ubuntu20.requirements.bash (closes #49)
    • Migrated isort and pytest to pyproject.toml (closes #48)
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Apr 12, 2021)

  • v0.2.2(Nov 14, 2019)

Owner
Eray Erdin
well...
Eray Erdin
A project to get you started with Docker and Django.

Docker Django tl;dr $ git clone [email protected]:erroneousboat/docker-django.git $ d

JP Bruins Slot 176 Dec 29, 2022
This is the starter for the Flask React project.

Flask React Project This is the starter for the Flask React project. Getting started Clone this repository (only this branch) git clone https://github

Jami Travers 5 May 25, 2022
Boilerplate for starting a python project

Python Project Boilerplate Simple boilerplate for starting a python proect. Using the repo Follow following steps to install client on server Create a

Prajwal Dahal 1 Nov 19, 2021
Django sample app with users including social auth via Django-AllAuth

demo-allauth-bootstrap Simple, out-of-the-box Django all-auth demo app A "brochure" or visitor (no login required) area A members-only (login required

Andrew E 215 Dec 20, 2022
Bleeding edge django template focused on code quality and security.

wemake-django-template Bleeding edge django2.2 template focused on code quality and security. Purpose This project is used to scaffold a django projec

wemake.services 1.6k Jan 08, 2023
Creating Templates and components so those can be reusable some time and makes workflow a lot easier!

TEMPLATES AND COMPONENTS IN ANY LANG! This is an Open Repository For Students to Contribute code in Hackoctoberfest in different Languages and Tech me

SriSravyaN 9 Feb 19, 2022
Python example making use of best practice file structure and multithreading.

Python example making use of best practice file structure and multithreading.

Bob 1 Oct 13, 2021
Flask Boilerplate - Material Kit Design | AppSeed

Flask Boilerplate - Material Kit Design | AppSeed

App Generator 45 Nov 18, 2022
NHS Theme for Streamlit applications

NHS Streamlit App Template Deployment (local) The tool has been built using Stre

nhs.pycom 3 Nov 07, 2022
A Django project skeleton that is modern and cutting edge.

{% comment "This comment section will be deleted in the generated project" %} Edge A Fantastic Django project starter. Features Ready Bootstrap-themed

Arun Ravindran 827 Dec 15, 2022
A template repo for use in the Advent of Code

AoC-Template A template repo for use in the Advent of Code The README_template.md must contain "STATS_TABLE" to be replaced by the generated table, an

0 Jan 14, 2022
Setup a flask project using a single command, right from creating virtual environment to creating Procfile for deployment.

AutoFlask-Setup About AutoFlask-Setup can help you set up a new Flask Project, right from creating virtual environment to creating Procfile for deploy

Ashutosh Krishna 1 Oct 21, 2021
CRUD app to create and save code snippets, Flask/Python restful Api/backend and React/Typescript frontend

MS3 Cheat-Hub A cheatsheet hub. An app that organizes your code snippets into collections of cheat sheets and allows you to view, like and save others

Joem Elias Sanez 21 Dec 28, 2022
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

18.7k Jan 08, 2023
Django Boilerplate - Material Kit Design | AppSeed

Django Boilerplate - Material Kit Design | AppSeed

App Generator 45 Dec 23, 2022
A Django starter template with a sound foundation.

SOS Django Template SOS Django Tempalate is a Django starter template that has opinionated and good solutions while starting your new Django project.

Eray Erdin 19 Oct 30, 2022
Combine the power of FastAPI and Django to build a production-ready application capable of utilizing all of the best features of both worlds.

FastAPI and Django Combo This projects aims to combine FastAPI and Django to build a Production ready application capable of utilizing all of the feat

Nsikak Imoh 33 Dec 27, 2022
Python-boilerplate - Python Boilerplate Project Structure

python-boilerplate Python Boilerplate Project Structure Folder Structure .github

1 Jan 18, 2022
Django starter project with 🔋

A batteries-included Django starter project. For a production-ready version see the book Django for Professionals. 🚀 Features Django 3.1 & Python 3.8

William Vincent 1.5k Jan 08, 2023
Mad-cookiecutter - Cookiecutter templates for MaD projects

MaD Cookiecutter Templates A set of templates that can be used to quickly get st

Machine Learning and Data Analytics Lab FAU 1 Jan 10, 2022