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
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
Forkable, Minimal Template for Starknet Projects.

Forkable, Minimal Template for Starknet Projects.

velleity.eth 44 Oct 09, 2022
Code Kata Python Template

Code Kata Python Template This is the code kata template for python created by Aula de Software Libre de la Universidad de Córdoba Step 1. Use this re

Sergio Gómez 2 Nov 30, 2021
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
A simple cookiecutter to create Python Telegram bots, wrapped with Django.

PTB Django cookiecutter A simple cookiecutter to create Python Telegram bots, wrapped with Django. Based on this cool projects python-telegram-bot (PT

Carlos Lugones 20 Nov 12, 2022
Template for creating ds simple projects

ds-project-template Template for creating ds simple projects Requirements pyenv python==3.9.4 Setup For this purpose you use following commands: pytho

1 Dec 17, 2021
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
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 04, 2023
A boilerplate for Django web applications

Django Hackathon Starter A boilerplate application for Django web applications. If you've attented hackathons, you already know how much time can be w

David Leonard 1.6k Dec 31, 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 06, 2023
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
Basic Docker Compose template application with Flask, Celery, Redis, MySQL, SocketIO, Nginx and Gunicorn.

Nginx / Gunicorn / Flask 🐍 / Celery / SocketIO / MySQL / Redis / Docker 🐳 sample application Basic Docker Compose template application for orchestat

Alex Oarga 8 Aug 06, 2022
A low dependency and really simple to start project template for Python Projects.

Python Project Template A low dependency and really simple to start project template for Python Projects. HOW TO USE THIS TEMPLATE DO NOT FORK this is

Yurii Dubinka 5 Jan 21, 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
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
Forkable, Minimal Template for Starknet Projects.

Forkable, Minimal Template for Starknet Projects.

andreas 44 Oct 09, 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
Simple boilerplate ready for development

StartApp Simple boilerplate ready for development Notes Currently supported frameworks are: FastApi, Flask 🔨 Installation $ sudo pip3 install starta

Sabuhi 16 Oct 16, 2022
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
PyPC is a very simple tool that creates Python projects from templates.

PyPC (Python Project Creator) PyPC is a very simple tool that creates Python projects from templates. In 0.1v#alpha, custom template creation will be

art3m1s 1 Nov 26, 2021