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
Generic python project template

generic-python-project-template generic-python-project-template STEPS - STEP 01- Create a repository by using template repository STEP 02- Clone the n

SUNNY BHAVEEN CHANDRA 3 Oct 03, 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
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

22 Dec 06, 2022
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
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
A Boilerplate repo for Scientific Python Open Science projects

A Boilerplate repo for Scientific Python Open Science projects Installation Clone this repo If you need a fresh python environment, run $ conda env cr

Vincent Choqueuse 2 Dec 23, 2021
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
A platform for developers 👩‍💻 who wants to share their programs and projects.

Hacktoberfest-2021 A platform for developers 👩‍💻 who wants to share their projects and programs. Hacktoberfest has updated their rules and now this

Mayank Choudhary 40 Nov 07, 2022
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
Django Webpack starter template for using Webpack 5 with Django 3.1 & Bootstrap 4. Yes, it can hot-reload.

Django Webpack Starter Hello fellow human. The repo uses Python 3.9.* Django 3.1.* Webpack 5.4.* Bootstrap 4.5.* Pipenv If you have any questions twe

Ganesh Khade 56 Nov 28, 2022
Template to quickly start your playwright-python project

Playwright-python template 🍪 Template to quickly start your playwright-python project Getting started • Demo • Configuration Getting started Clone th

Constantin 1 Dec 13, 2021
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
The Django Base Site is a Django site that is built using the best Django practices and comes with all the common Django packages that you need to jumpstart your next project.

Django Base Site The Django Base Site is a Django site that is built using the best Django practices and comes with all the common Django packages tha

Brent O'Connor 167 Jan 03, 2023
A test Django application with production-level docker setup

DockerApp A test Django application with production-level docker setup. Blog: https://medium.com/@siddharth.sahu/the-near-perfect-dockerfile-for-djang

Siddharth Sahu 44 Nov 18, 2022
Django Boilerplate - Material Kit Design | AppSeed

Django Boilerplate - Material Kit Design | AppSeed

App Generator 45 Dec 23, 2022
This is a FastAPI, React, MongoDB stack Boilerplate. It's as glorious as a highland coo.

Coo - F.A.R.M stack BoilerPlate F.A.R.M - FastAPI, React, MongoDB This boilerplate utilizes FastAPI to build a REST API, MongoDB for data storage, and

Peter Waters 2 Feb 06, 2022
Cookiecutter Flask OpenAPI is a template for jumpstarting production-ready Flask projects quickly.

Cookiecutter Flask OpenAPI is a template for jumpstarting production-ready Flask projects quickly. It has a well organized and scalable structure. It uses API design first

Roger Camargo 3 Nov 17, 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
A template for some new Python tool or package with a reasonable basic setup.

python-app-template A template with a reasonable basic setup, including: black (formatting) flake8 (linting) mypy (type checking) isort (import sortin

Anton Pirogov 3 Jul 19, 2022