diff --git a/.gitignore b/.gitignore index 9db03e46..53dd4f31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -# Created by .ignore support plugin (hsz.mobi) -### Python template # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -22,7 +20,6 @@ parts/ sdist/ var/ wheels/ -pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg @@ -88,7 +85,7 @@ ipython_config.py # pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: -# .python-version +.python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. @@ -97,7 +94,22 @@ ipython_config.py # install all needed dependencies. #Pipfile.lock -# PEP 582; used by e.g. github.com/David-OConnor/pyflow +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff @@ -140,15 +152,216 @@ dmypy.json # Cython debug symbols cython_debug/ -### Example user template template -### Example user template +### JetBrains + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Node.js + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt -# IntelliJ project files -.idea -*.iml +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next out -gen +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* -# other -.history/ \ No newline at end of file diff --git a/README.md b/README.md index 762ecaaf..0fd3292a 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ Creating a new project using this repo: $ git clone git@github.com:sixfeetup/cookiecutter-sixiedjango.git $ cd cookiecutter-sixiedjango - # checkout a branch if you need to + ### checkout a branch if you need to $ python3 -m venv $ venv/bin/pip install -r requirements.txt $ venv/bin/activate - $ cookiecutter . + $ cookiecutter . -o [path to destination directory] Answer the questions, and you'll have your new project! @@ -23,5 +23,6 @@ Answer the questions, and you'll have your new project! When making changes to the Cookie Cutter, keep the following in mind: -* update pins in requirements/*.in files -* update to latest Python supported by Django \ No newline at end of file +* update pins in requirements/*.in files but *don't* commit the compiled requirements.txt + files to the repo. +* update to latest Python supported by Django. For Django 4.1 this is 3.8, 3.9, and 3.10. \ No newline at end of file diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index ecc2d105..8091ba6d 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,17 +1,10 @@ -""" -NOTE: - the below code is to be maintained Python 2.x-compatible - as the whole Cookiecutter Django project initialization - can potentially be run in Python 2.x environment - (at least so we presume in `pre_gen_project.py`). -""" -from __future__ import print_function - import os import random import shutil import string import zipfile +import subprocess +import shlex try: # Inspired by @@ -225,6 +218,9 @@ def main(): if "{{ cookiecutter.use_drf }}".lower() == "n": remove_drf_starter_files() + subprocess.run(shlex.split("black .")) + subprocess.run(shlex.split("isort --profile=black .")) + print(SUCCESS + "Project initialized, keep up the good work!" + TERMINATOR) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 51e692c4..1d58c88d 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,12 +1,3 @@ -""" -NOTE: - the below code is to be maintained Python 2.x-compatible - as the whole Cookiecutter Django project initialization - can potentially be run in Python 2.x environment. - -""" -from __future__ import print_function - import sys TERMINATOR = "\x1b[0m" diff --git a/requirements.txt b/requirements.txt index 2e194117..c4d07c8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,106 +2,309 @@ # This file is autogenerated by pip-compile with python 3.10 # To update, run: # -# pip-compile +# pip-compile --generate-hashes # -arrow==1.2.2 +arrow==1.2.2 \ + --hash=sha256:05caf1fd3d9a11a1135b2b6f09887421153b94558e5ef4d090b567b47173ac2b \ + --hash=sha256:d622c46ca681b5b3e3574fcb60a04e5cc81b9625112d5fb2b44220c36c892177 # via jinja2-time -attrs==21.4.0 +attrs==21.4.0 \ + --hash=sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4 \ + --hash=sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd # via pytest -binaryornot==0.4.4 +binaryornot==0.4.4 \ + --hash=sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061 \ + --hash=sha256:b8b71173c917bddcd2c16070412e369c3ed7f0528926f70cac18a6c97fd563e4 # via # -r requirements.in # cookiecutter -black==22.1.0 +black==22.1.0 \ + --hash=sha256:07e5c049442d7ca1a2fc273c79d1aecbbf1bc858f62e8184abe1ad175c4f7cc2 \ + --hash=sha256:0e21e1f1efa65a50e3960edd068b6ae6d64ad6235bd8bfea116a03b21836af71 \ + --hash=sha256:1297c63b9e1b96a3d0da2d85d11cd9bf8664251fd69ddac068b98dc4f34f73b6 \ + --hash=sha256:228b5ae2c8e3d6227e4bde5920d2fc66cc3400fde7bcc74f480cb07ef0b570d5 \ + --hash=sha256:2d6f331c02f0f40aa51a22e479c8209d37fcd520c77721c034517d44eecf5912 \ + --hash=sha256:2ff96450d3ad9ea499fc4c60e425a1439c2120cbbc1ab959ff20f7c76ec7e866 \ + --hash=sha256:3524739d76b6b3ed1132422bf9d82123cd1705086723bc3e235ca39fd21c667d \ + --hash=sha256:35944b7100af4a985abfcaa860b06af15590deb1f392f06c8683b4381e8eeaf0 \ + --hash=sha256:373922fc66676133ddc3e754e4509196a8c392fec3f5ca4486673e685a421321 \ + --hash=sha256:5fa1db02410b1924b6749c245ab38d30621564e658297484952f3d8a39fce7e8 \ + --hash=sha256:6f2f01381f91c1efb1451998bd65a129b3ed6f64f79663a55fe0e9b74a5f81fd \ + --hash=sha256:742ce9af3086e5bd07e58c8feb09dbb2b047b7f566eb5f5bc63fd455814979f3 \ + --hash=sha256:7835fee5238fc0a0baf6c9268fb816b5f5cd9b8793423a75e8cd663c48d073ba \ + --hash=sha256:8871fcb4b447206904932b54b567923e5be802b9b19b744fdff092bd2f3118d0 \ + --hash=sha256:a7c0192d35635f6fc1174be575cb7915e92e5dd629ee79fdaf0dcfa41a80afb5 \ + --hash=sha256:b1a5ed73ab4c482208d20434f700d514f66ffe2840f63a6252ecc43a9bc77e8a \ + --hash=sha256:c8226f50b8c34a14608b848dc23a46e5d08397d009446353dad45e04af0c8e28 \ + --hash=sha256:ccad888050f5393f0d6029deea2a33e5ae371fd182a697313bdbd835d3edaf9c \ + --hash=sha256:dae63f2dbf82882fa3b2a3c49c32bffe144970a573cd68d247af6560fc493ae1 \ + --hash=sha256:e2f69158a7d120fd641d1fa9a921d898e20d52e44a74a6fbbcc570a62a6bc8ab \ + --hash=sha256:efbadd9b52c060a8fc3b9658744091cb33c31f830b3f074422ed27bad2b18e8f \ + --hash=sha256:f5660feab44c2e3cb24b2419b998846cbb01c23c7fe645fee45087efa3da2d61 \ + --hash=sha256:fdb8754b453fb15fad3f72cd9cad3e16776f0964d67cf30ebcbf10327a3777a3 # via -r requirements.in -certifi==2021.10.8 +certifi==2021.10.8 \ + --hash=sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872 \ + --hash=sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569 # via requests -chardet==4.0.0 +chardet==4.0.0 \ + --hash=sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa \ + --hash=sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5 # via binaryornot -charset-normalizer==2.0.12 +charset-normalizer==2.0.12 \ + --hash=sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597 \ + --hash=sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df # via requests -click==8.0.4 +click==8.0.4 \ + --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ + --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb # via # black # cookiecutter -cookiecutter==1.7.3 +cookiecutter==1.7.3 \ + --hash=sha256:6b9a4d72882e243be077a7397d0f1f76fe66cf3df91f3115dbb5330e214fa457 \ + --hash=sha256:f8671531fa96ab14339d0c59b4f662a4f12a2ecacd94a0f70a3500843da588e2 # via # -r requirements.in # pytest-cookies -flake8==4.0.1 +distlib==0.3.5 \ + --hash=sha256:a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe \ + --hash=sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c + # via virtualenv +filelock==3.8.0 \ + --hash=sha256:55447caa666f2198c5b6b13a26d2084d26fa5b115c00d065664b2124680c4edc \ + --hash=sha256:617eb4e5eedc82fc5f47b6d61e4d11cb837c56cb4544e39081099fa17ad109d4 + # via + # tox + # virtualenv +flake8==4.0.1 \ + --hash=sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d \ + --hash=sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d # via # -r requirements.in # flake8-isort -flake8-isort==4.1.1 +flake8-isort==4.1.1 \ + --hash=sha256:c4e8b6dcb7be9b71a02e6e5d4196cefcef0f3447be51e82730fb336fff164949 \ + --hash=sha256:d814304ab70e6e58859bc5c3e221e2e6e71c958e7005239202fee19c24f82717 # via -r requirements.in -idna==3.3 +idna==3.3 \ + --hash=sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff \ + --hash=sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d # via requests -iniconfig==1.1.1 +iniconfig==1.1.1 \ + --hash=sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3 \ + --hash=sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32 # via pytest -isort==5.10.1 +isort==5.10.1 \ + --hash=sha256:6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7 \ + --hash=sha256:e8443a5e7a020e9d7f97f1d7d9cd17c88bcb3bc7e218bf9cf5095fe550be2951 # via # -r requirements.in # flake8-isort -jinja2==3.0.3 +jinja2==3.0.3 \ + --hash=sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8 \ + --hash=sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7 # via # cookiecutter # jinja2-time -jinja2-time==0.2.0 +jinja2-time==0.2.0 \ + --hash=sha256:d14eaa4d315e7688daa4969f616f226614350c48730bfa1692d2caebd8c90d40 \ + --hash=sha256:d3eab6605e3ec8b7a0863df09cc1d23714908fa61aa6986a845c20ba488b4efa # via cookiecutter -markupsafe==2.1.0 +markupsafe==2.1.0 \ + --hash=sha256:023af8c54fe63530545f70dd2a2a7eed18d07a9a77b94e8bf1e2ff7f252db9a3 \ + --hash=sha256:09c86c9643cceb1d87ca08cdc30160d1b7ab49a8a21564868921959bd16441b8 \ + --hash=sha256:142119fb14a1ef6d758912b25c4e803c3ff66920635c44078666fe7cc3f8f759 \ + --hash=sha256:1d1fb9b2eec3c9714dd936860850300b51dbaa37404209c8d4cb66547884b7ed \ + --hash=sha256:204730fd5fe2fe3b1e9ccadb2bd18ba8712b111dcabce185af0b3b5285a7c989 \ + --hash=sha256:24c3be29abb6b34052fd26fc7a8e0a49b1ee9d282e3665e8ad09a0a68faee5b3 \ + --hash=sha256:290b02bab3c9e216da57c1d11d2ba73a9f73a614bbdcc027d299a60cdfabb11a \ + --hash=sha256:3028252424c72b2602a323f70fbf50aa80a5d3aa616ea6add4ba21ae9cc9da4c \ + --hash=sha256:30c653fde75a6e5eb814d2a0a89378f83d1d3f502ab710904ee585c38888816c \ + --hash=sha256:3cace1837bc84e63b3fd2dfce37f08f8c18aeb81ef5cf6bb9b51f625cb4e6cd8 \ + --hash=sha256:4056f752015dfa9828dce3140dbadd543b555afb3252507348c493def166d454 \ + --hash=sha256:454ffc1cbb75227d15667c09f164a0099159da0c1f3d2636aa648f12675491ad \ + --hash=sha256:598b65d74615c021423bd45c2bc5e9b59539c875a9bdb7e5f2a6b92dfcfc268d \ + --hash=sha256:599941da468f2cf22bf90a84f6e2a65524e87be2fce844f96f2dd9a6c9d1e635 \ + --hash=sha256:5ddea4c352a488b5e1069069f2f501006b1a4362cb906bee9a193ef1245a7a61 \ + --hash=sha256:62c0285e91414f5c8f621a17b69fc0088394ccdaa961ef469e833dbff64bd5ea \ + --hash=sha256:679cbb78914ab212c49c67ba2c7396dc599a8479de51b9a87b174700abd9ea49 \ + --hash=sha256:6e104c0c2b4cd765b4e83909cde7ec61a1e313f8a75775897db321450e928cce \ + --hash=sha256:736895a020e31b428b3382a7887bfea96102c529530299f426bf2e636aacec9e \ + --hash=sha256:75bb36f134883fdbe13d8e63b8675f5f12b80bb6627f7714c7d6c5becf22719f \ + --hash=sha256:7d2f5d97fcbd004c03df8d8fe2b973fe2b14e7bfeb2cfa012eaa8759ce9a762f \ + --hash=sha256:80beaf63ddfbc64a0452b841d8036ca0611e049650e20afcb882f5d3c266d65f \ + --hash=sha256:84ad5e29bf8bab3ad70fd707d3c05524862bddc54dc040982b0dbcff36481de7 \ + --hash=sha256:8da5924cb1f9064589767b0f3fc39d03e3d0fb5aa29e0cb21d43106519bd624a \ + --hash=sha256:961eb86e5be7d0973789f30ebcf6caab60b844203f4396ece27310295a6082c7 \ + --hash=sha256:96de1932237abe0a13ba68b63e94113678c379dca45afa040a17b6e1ad7ed076 \ + --hash=sha256:a0a0abef2ca47b33fb615b491ce31b055ef2430de52c5b3fb19a4042dbc5cadb \ + --hash=sha256:b2a5a856019d2833c56a3dcac1b80fe795c95f401818ea963594b345929dffa7 \ + --hash=sha256:b8811d48078d1cf2a6863dafb896e68406c5f513048451cd2ded0473133473c7 \ + --hash=sha256:c532d5ab79be0199fa2658e24a02fce8542df196e60665dd322409a03db6a52c \ + --hash=sha256:d3b64c65328cb4cd252c94f83e66e3d7acf8891e60ebf588d7b493a55a1dbf26 \ + --hash=sha256:d4e702eea4a2903441f2735799d217f4ac1b55f7d8ad96ab7d4e25417cb0827c \ + --hash=sha256:d5653619b3eb5cbd35bfba3c12d575db2a74d15e0e1c08bf1db788069d410ce8 \ + --hash=sha256:d66624f04de4af8bbf1c7f21cc06649c1c69a7f84109179add573ce35e46d448 \ + --hash=sha256:e67ec74fada3841b8c5f4c4f197bea916025cb9aa3fe5abf7d52b655d042f956 \ + --hash=sha256:e6f7f3f41faffaea6596da86ecc2389672fa949bd035251eab26dc6697451d05 \ + --hash=sha256:f02cf7221d5cd915d7fa58ab64f7ee6dd0f6cddbb48683debf5d04ae9b1c2cc1 \ + --hash=sha256:f0eddfcabd6936558ec020130f932d479930581171368fd728efcfb6ef0dd357 \ + --hash=sha256:fabbe18087c3d33c5824cb145ffca52eccd053061df1d79d4b66dafa5ad2a5ea \ + --hash=sha256:fc3150f85e2dbcf99e65238c842d1cfe69d3e7649b19864c1cc043213d9cd730 # via jinja2 -mccabe==0.6.1 +mccabe==0.6.1 \ + --hash=sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42 \ + --hash=sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f # via flake8 -mypy-extensions==0.4.3 - # via black -packaging==21.3 - # via pytest -pathspec==0.9.0 +mypy-extensions==0.4.3 \ + --hash=sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d \ + --hash=sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8 # via black -platformdirs==2.5.1 +packaging==21.3 \ + --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ + --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 + # via + # pytest + # tox +pathspec==0.9.0 \ + --hash=sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a \ + --hash=sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1 # via black -pluggy==1.0.0 - # via pytest -poyo==0.5.0 +platformdirs==2.5.1 \ + --hash=sha256:7535e70dfa32e84d4b34996ea99c5e432fa29a708d0f4e394bbcb2a8faa4f16d \ + --hash=sha256:bcae7cab893c2d310a711b70b24efb93334febe65f8de776ee320b517471e227 + # via + # black + # virtualenv +pluggy==1.0.0 \ + --hash=sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159 \ + --hash=sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3 + # via + # pytest + # tox +poyo==0.5.0 \ + --hash=sha256:3e2ca8e33fdc3c411cd101ca395668395dd5dc7ac775b8e809e3def9f9fe041a \ + --hash=sha256:e26956aa780c45f011ca9886f044590e2d8fd8b61db7b1c1cf4e0869f48ed4dd # via cookiecutter -py==1.11.0 - # via pytest -pycodestyle==2.8.0 +py==1.11.0 \ + --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ + --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 + # via + # pytest + # tox +pycodestyle==2.8.0 \ + --hash=sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20 \ + --hash=sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f # via flake8 -pyflakes==2.4.0 +pyflakes==2.4.0 \ + --hash=sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c \ + --hash=sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e # via flake8 -pyparsing==3.0.7 +pyparsing==3.0.7 \ + --hash=sha256:18ee9022775d270c55187733956460083db60b37d0d0fb357445f3094eed3eea \ + --hash=sha256:a6c06a88f252e6c322f65faf8f418b16213b51bdfaece0524c1c1bc30c63c484 # via packaging -pytest==7.0.1 +pytest==7.0.1 \ + --hash=sha256:9ce3ff477af913ecf6321fe337b93a2c0dcf2a0a1439c43f5452112c1e4280db \ + --hash=sha256:e30905a0c131d3d94b89624a1cc5afec3e0ba2fbdb151867d8e0ebd49850f171 # via # -r requirements.in # pytest-cookies # pytest-instafail -pytest-cookies==0.6.1 +pytest-cookies==0.6.1 \ + --hash=sha256:2e2383c12a321753676c8944fb75b3c8ccac70fce58e27d6b201e1a3ff3dab27 \ + --hash=sha256:94c41ad914d420b57bc31d58ab2c0b103322c11d07d13b8d245c85fa9b069714 # via -r requirements.in -pytest-instafail==0.4.2 +pytest-instafail==0.4.2 \ + --hash=sha256:19273fdf3f0f9a1cb4b7a0bc8aa1bdaaf6b0f62a681b693d5eca4626abc99782 \ + --hash=sha256:1ec440a177be89a9ed2759dade8e1f7a2b95bac74ae81dc91318d309bf4ebd4f # via -r requirements.in -python-dateutil==2.8.2 +python-dateutil==2.8.2 \ + --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ + --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 # via arrow -python-slugify==6.1.0 +python-slugify==6.1.0 \ + --hash=sha256:2e3fad0bf38b11514f8de911ea04e7a6c6a08bb1bac18abd96d9566c34404d56 \ + --hash=sha256:eff190e4dfac97d2f8c1890ee682709ecd23650742361687db82d95e1e5e25f5 # via cookiecutter -pyyaml==6.0 +pyyaml==6.0 \ + --hash=sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293 \ + --hash=sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b \ + --hash=sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57 \ + --hash=sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b \ + --hash=sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4 \ + --hash=sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07 \ + --hash=sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba \ + --hash=sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9 \ + --hash=sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287 \ + --hash=sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513 \ + --hash=sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0 \ + --hash=sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0 \ + --hash=sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92 \ + --hash=sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f \ + --hash=sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2 \ + --hash=sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc \ + --hash=sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c \ + --hash=sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86 \ + --hash=sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4 \ + --hash=sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c \ + --hash=sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34 \ + --hash=sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b \ + --hash=sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c \ + --hash=sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb \ + --hash=sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737 \ + --hash=sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3 \ + --hash=sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d \ + --hash=sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53 \ + --hash=sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78 \ + --hash=sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803 \ + --hash=sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a \ + --hash=sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174 \ + --hash=sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5 # via -r requirements.in -requests==2.27.1 +requests==2.27.1 \ + --hash=sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61 \ + --hash=sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d # via cookiecutter -sh==1.14.2 +sh==1.14.2 \ + --hash=sha256:4921ac9c1a77ec8084bdfaf152fe14138e2b3557cc740002c1a97076321fce8a \ + --hash=sha256:9d7bd0334d494b2a4609fe521b2107438cdb21c0e469ffeeb191489883d6fe0d # via -r requirements.in -six==1.16.0 +six==1.16.0 \ + --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ + --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 # via # cookiecutter # python-dateutil -testfixtures==6.18.3 + # tox +testfixtures==6.18.3 \ + --hash=sha256:2600100ae96ffd082334b378e355550fef8b4a529a6fa4c34f47130905c7426d \ + --hash=sha256:6ddb7f56a123e1a9339f130a200359092bd0a6455e31838d6c477e8729bb7763 # via flake8-isort -text-unidecode==1.3 +text-unidecode==1.3 \ + --hash=sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8 \ + --hash=sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93 # via python-slugify -tomli==2.0.1 +toml==0.10.2 \ + --hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \ + --hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f + # via tox +tomli==2.0.1 \ + --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ + --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f # via # black # pytest -urllib3==1.26.8 +tox==3.25.1 \ + --hash=sha256:c138327815f53bc6da4fe56baec5f25f00622ae69ef3fe4e1e385720e22486f9 \ + --hash=sha256:c38e15f4733683a9cc0129fba078633e07eb0961f550a010ada879e95fb32632 + # via -r requirements.in +urllib3==1.26.8 \ + --hash=sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed \ + --hash=sha256:0e7c33d9a63e7ddfcb86780aac87befc2fbddf46c58dbb487e0855f7ceec283c # via requests +virtualenv==20.16.3 \ + --hash=sha256:4193b7bc8a6cd23e4eb251ac64f29b4398ab2c233531e66e40b19a6b7b0d30c1 \ + --hash=sha256:d86ea0bb50e06252d79e6c241507cb904fcd66090c3271381372d6221a3970f9 + # via tox diff --git a/setup.py b/setup.py index 65c1eaa0..e4ede158 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ # Our version ALWAYS matches the version of Django we support # If Django has a new release, we branch, tag, then update this setting after the tag. -version = "3.0.8" +version = "4.1.0" if sys.argv[-1] == "tag": os.system(f'git tag -a {version} -m "version {version}"') diff --git a/{{cookiecutter.project_slug}}/Dockerfile b/{{cookiecutter.project_slug}}/Dockerfile index fb46f5d2..f031f842 100644 --- a/{{cookiecutter.project_slug}}/Dockerfile +++ b/{{cookiecutter.project_slug}}/Dockerfile @@ -1,5 +1,5 @@ # Build all of the dependencies then we will build the actual application image -FROM python:3.10.6-slim-bullseye as build +FROM python:3.10-slim-bullseye as build ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 @@ -60,7 +60,7 @@ RUN set -x \ -r /tmp/requirements/tests.txt; fi # Next build front-end -FROM node:lts-bullseye-slim as front-end +FROM node:16-bullseye-slim as front-end WORKDIR /app @@ -71,7 +71,7 @@ RUN npm run build # Now we can build the application image -FROM python:3.10.6-slim-bullseye +FROM python:3.10-slim-bullseye ENV PYTHONUNBUFFERED 1 ENV PYTHONPATH /app diff --git a/{{cookiecutter.project_slug}}/Makefile b/{{cookiecutter.project_slug}}/Makefile index 2421f13c..01305a63 100644 --- a/{{cookiecutter.project_slug}}/Makefile +++ b/{{cookiecutter.project_slug}}/Makefile @@ -27,15 +27,21 @@ clean: ## Remove the latest build squeaky-clean: clean ## Aggressively remove unused images - @docker rmi python:3.8-slim + @docker rmi python:3.10-slim-bullseye + @docker rmi postgres:14 + @docker rmi mailhog/mailhog:v1.0.0 + @docker rmi node:16-bullseye-slim + @docker rmi redis:6.2 @docker system prune -a @for image in `docker images -f "dangling=true" -q`; do \ echo removing $$image && docker rmi $$image ; done update: ## Grab latest images for project - @docker pull python:3.10.6-slim-bullseye + @docker pull python:3.10-slim-bullseye @docker pull postgres:14 @docker pull mailhog/mailhog:v1.0.0 + @docker pull node:16-bullseye-slim + @docker pull redis:6.2 @@ -81,8 +87,8 @@ check-sandbox-release check-staging-release check-prod-release: ## check status ## Development Targets -build-dev: export DOCKER_BUILDKIT = 1 -build-dev: Dockerfile ## Create the dev build and runtime images +build-dev: export DOCKER_BUILDKIT = 1 ## Create the dev build and runtime images +build-dev: Dockerfile @docker build --build-arg DEVEL=yes --build-arg TEST=yes -t {{ cookiecutter.project_slug }}_local_django:dev . outdated: ## Show outdated packages in the container @@ -92,7 +98,7 @@ pipdeptree: ## Show pipdeptree output @docker run --rm {{ cookiecutter.project_slug }}_local_django:$(TAG) pipdeptree compile: requirements/base.in requirements/tests.in ## compile latest requirements to be built into the docker image - @docker run --rm -v $(shell pwd)/requirements:/local python:3.10.6-slim-bullseye /bin/bash -c \ + @docker run --rm -v $(shell pwd)/requirements:/local python:3.10-slim-bullseye /bin/bash -c \ "apt-get update; apt-get install -y libpq-dev; \ pip install pip-tools; \ touch /local/base.txt; touch /local/production.txt; touch /local/tests.txt; touch /local/local.txt; \ @@ -108,13 +114,14 @@ load-dump: destroy-data ## Fresh load the data file passed in clean-dev: ## Remove the latest build @docker rmi -f {{ cookiecutter.project_slug }}_local_django:dev -up: - ## start up the cluster locally +up: ## start up the cluster locally @docker-compose -f ./docker-compose.yml -f ./docker-compose.override.yml up -down: - ## shut down the cluster - docker-compose -f ./docker-compose.yml down +down: ## shut down the cluster + @docker-compose -f ./docker-compose.yml down + +down-clean: + @docker-compose -f ./docker-compose.yml down --remove-orphans test: ## Run the PyTests for the Django Application @docker-compose exec django pytest @@ -122,8 +129,8 @@ test: ## Run the PyTests for the Django Application shell: ## Shell into the running Django container @docker-compose exec django /bin/bash -node: ## Shell into the running Node container - @docker-compose exec front-end /bin/bash +#node: ## Shell into the running Node container +# @docker-compose exec front-end /bin/bash help: ## This help. @awk 'BEGIN { FS = ":.*##"; target="";printf "\nUsage:\n make \033[36m\033[33m\n\nTargets:\033[0m\n" } \ diff --git a/{{cookiecutter.project_slug}}/Readme.md b/{{cookiecutter.project_slug}}/Readme.md index 0315923e..6e9ef433 100644 --- a/{{cookiecutter.project_slug}}/Readme.md +++ b/{{cookiecutter.project_slug}}/Readme.md @@ -1,20 +1,9 @@ -# {{ cookiecutter.project_name }} in Django - - $ git clone [repo] - $ cd {{ cookiecutter.project_slug }} - $ make build-dev - $ make up - -Access the site locally at http://localhost:8009/ - -Create a superuser: - - $ make shell - $ ./manage.py createsuperuser +# {{ cookiecutter.project_name }} ## Initial Project Setup -When creating a new project, you will need to compile the pinned versions +For the initial setup once the project has been generated, you will need to +compile the pinned versions of the project's Python package dependencies (*before* running `make build-dev`): $ make compile @@ -25,4 +14,39 @@ If you need to update version pins for your project: * make or add the change in the appropriate requrements/*.in file * run `make compile` -* if you need to see what packages are out of date, run `make outdated` \ No newline at end of file +* if you need to see what packages are out of date, run `make outdated` + +At this point, it's probably a good idea to commit this initial version of the project +to version control: + + $ git init + $ git add . + $ git commit -m 'Initial commit' + +You can then use any of a number of available git repository sites such as Bitbucket, +Gitlab, or GitHub to host the project; follow their instructions to push the repo to their +systems. + +## Contributor setup + +For subsequent contributors (after the project has been through initial setup and +pushed to a git repo), the `make compile` step should be skipped unless the express +intention is to update the package dependencies: + + $ git clone [repo] + $ cd {{ cookiecutter.project_slug }} + $ make build-dev + $ make up + +It may take a little bit of time for all the services to start up, and it's possible for +the first run to fail because of timing conflicts. If you do see messages indicating there +were errors during the first run, stop all the containers using Ctrl-C, and then try it again. + +Once all the containers are running, you should be able to +access the site locally at `http://localhost:8009/` + +Create a superuser: + + $ make shell + $ ./manage.py createsuperuser + diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py index 0858ac9c..17bdd271 100644 --- a/{{cookiecutter.project_slug}}/config/settings/production.py +++ b/{{cookiecutter.project_slug}}/config/settings/production.py @@ -14,7 +14,7 @@ SECRET_KEY = env("DJANGO_SECRET_KEY") # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["{{ cookiecutter.domain_name }}"]) - +CSRF_TRUSTED_ORIGINS = env.list("DJANGO_CSRF_TRUSTED_ORIGINS", default=["http://localhost", "https://{{ cookiecutter.domain_name }}"]) # DATABASES # ------------------------------------------------------------------------------ DATABASES["default"] = env.db("DATABASE_URL") # noqa F405 diff --git a/{{cookiecutter.project_slug}}/docker-compose.yml b/{{cookiecutter.project_slug}}/docker-compose.yml index b37988c8..a926199b 100644 --- a/{{cookiecutter.project_slug}}/docker-compose.yml +++ b/{{cookiecutter.project_slug}}/docker-compose.yml @@ -12,8 +12,8 @@ services: - local/environment django: image: '{{ cookiecutter.project_slug }}_local_django:dev' - #command: 'python manage.py runserver 0.0.0.0:8000' - command: 'gunicorn config.asgi:application -k uvicorn.workers.UvicornWorker' + command: 'python manage.py runserver 0.0.0.0:8000' + # command: 'gunicorn config.asgi:application -k uvicorn.workers.UvicornWorker' volumes: - '.:/app/src:z' env_file: @@ -72,7 +72,7 @@ services: - redis {% endif %} # front-end: -# image: 'node:lts-bullseye-slim' +# image: 'node:16-bullseye-slim' # user: node # working_dir: /app # environment: @@ -84,7 +84,7 @@ services: # - front-end-install # stdin_open: true # front-end-install: -# image: 'node:lts-bullseye-slim' +# image: 'node:16-bullseye-slim' # user: node # working_dir: /app # volumes: diff --git a/{{cookiecutter.project_slug}}/local/environment b/{{cookiecutter.project_slug}}/local/environment index 8b646aba..91433729 100644 --- a/{{cookiecutter.project_slug}}/local/environment +++ b/{{cookiecutter.project_slug}}/local/environment @@ -1,16 +1,18 @@ USE_DOCKER=yes - +{%- if cookiecutter.use_celery == "y" %} CELERY_BROKER_URL=redis://redis:6379/0 FLOWER_BROKER_URL=redis://redis:6379/0 FLOWER_ADDRESS=0.0.0.0 FLOWER_PORT=5555 +{%- endif %} + DJANGO_ADMIN_URL=^admin/ DJANGO_SETTINGS_MODULE=config.settings.local DJANGO_SECRET_KEY=CHANGEME -DJANGO_ALLOWED_HOSTS=localhost,django,{{ cookiecutter.project_slug }} - +DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,django,{{ cookiecutter.domain_name }} +DJANGO_CSRF_TRUSTED_ORIGINS=http://localhost,https://{{ cookiecutter.domain_name }} POSTGRES_USER={{ cookiecutter.project_slug }} POSTGRES_PASSWORD=CHANGEME diff --git a/{{cookiecutter.project_slug}}/requirements/base.in b/{{cookiecutter.project_slug}}/requirements/base.in index 8342f7c4..9c0ffd23 100644 --- a/{{cookiecutter.project_slug}}/requirements/base.in +++ b/{{cookiecutter.project_slug}}/requirements/base.in @@ -42,7 +42,7 @@ python-crontab>=2.3.4 # Django # ------------------------------------------------------------------------------ django~=4.1.0 # https://www.djangoproject.com/ -django-environ==0.9.0 # https://github.com/joke2k/django-environ +django-environ>=0.9.0 # https://github.com/joke2k/django-environ django-model-utils==4.2.0 # https://github.com/jazzband/django-model-utils django-allauth==0.51.0 # https://github.com/pennersr/django-allauth django-crispy-forms==1.14.0 # https://github.com/django-crispy-forms/django-crispy-forms diff --git a/{{cookiecutter.project_slug}}/requirements/local.in b/{{cookiecutter.project_slug}}/requirements/local.in index f899eaf8..ee6440f6 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.in +++ b/{{cookiecutter.project_slug}}/requirements/local.in @@ -1,5 +1,5 @@ # Local development dependencies go here -django-debug-toolbar==3.2.1 +django-debug-toolbar~=3.2.0 # django-extensions==3.2.0 ipdb pip-tools