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 python starter package to be used as a template for creating your own python packages.

Python Starter Package This is a basic python starter package to be used as a template for creating your own python packages. Github repo: https://git

Mystic 1 Apr 4, 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 8, 2023
Django project/application starter for lazybones :)

Django Project Starter Template My custom project starter for Django! I’ll try to support every upcoming Django releases as much as I can! Requirement

Uğur Özyılmazel 40 Jul 16, 2022
Launchr is an open source SaaS starter kit, based on Django.

Launchr Launchr is an open source SaaS starter kit. About Launchr is a fully-equipped starter template, ready to start a SaaS web app. It implements t

Jannis Gebauer 183 Jan 6, 2023
simple flask starter app utilizing docker

Simple flask starter app utilizing docker to showcase seasonal anime using jikanpy (myanimelist unofficial api).

Kennedy Ngugi Mwaura 5 Dec 15, 2021
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
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

Parker Bolick 2 May 14, 2022
Starter project for python based lambda project.

Serverless Python Starter Starter project for python based lambda project. Features FastAPI - Frontend dev with Hot Reload API Gateway Integration (+r

null 4 Feb 22, 2022
The starter repository for submissions to the GeneDisco challenge for optimized experimental design in genetic perturbation experiments

GeneDisco ICLR-22 Challenge Starter Repository The starter repository for submissions to the GeneDisco challenge for optimized experimental design in

null 22 Dec 6, 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 4, 2023
Project template layout for Django 3.0+

Django 3.0+ project template This is a simple Django 3.0+ project template with my preferred setup. Most Django project templates make way too many as

José Padilla 649 Dec 30, 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 8, 2023
Um template para quem quiser usar o Docker + PGSQL + Django.

Um template para quem quiser usar o Docker + PGSQL + Django.

Drack 2 Mar 11, 2022
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
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Roy Greenfeld 10k Jan 1, 2023
Vue + Django with no compromises. Django Templates and Vue SFCs in harmony without sacrificing the full power of either.

Cookiecutter Vue Django Vue + Django with no compromise. Cookiecutter Vue Django is a framework for jumpstarting production-ready Django + Vue project

Mike Hoolehan 122 Dec 22, 2022
Ultimate Django3.2 Template for starting any project from not zero!

Ultimate Django3.2 Template for starting any project from not zero!

TheAliBigdeli 37 Dec 20, 2022
Generic template for python service

Cookie cutter template example Technology stack Flask Gevent UWSGI Poetry Docker Docker-compose Installation pip install cookiecutter cookiecutter git

Churkin Oleg 11 Oct 22, 2022
Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Joonhyung Lee/이준형 651 Dec 12, 2022