-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code CleanUp and consolidation with django cookiecutter
- Loading branch information
1 parent
3b54d35
commit fe5cc5f
Showing
15,982 changed files
with
633 additions
and
1,434,194 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# | ||
# .bashrc.override.sh | ||
# | ||
|
||
# persistent bash history | ||
HISTFILE=~/.bash_history | ||
PROMPT_COMMAND="history -a; $PROMPT_COMMAND" | ||
|
||
# set some django env vars | ||
source /entrypoint | ||
|
||
# restore default shell options | ||
set +o errexit | ||
set +o pipefail | ||
set +o nounset | ||
|
||
# start ssh-agent | ||
# https://code.visualstudio.com/docs/remote/troubleshooting | ||
eval "$(ssh-agent -s)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// For format details, see https://containers.dev/implementors/json_reference/ | ||
{ | ||
"name": "cookie_cutter_dev", | ||
"dockerComposeFile": ["../local.yml"], | ||
"init": true, | ||
"mounts": [ | ||
{ | ||
"source": "./.devcontainer/bash_history", | ||
"target": "/home/dev-user/.bash_history", | ||
"type": "bind" | ||
}, | ||
{ | ||
"source": "/tmp", | ||
"target": "/tmp", | ||
"type": "bind" | ||
}, | ||
{ | ||
"source": "~/.ssh", | ||
"target": "/home/dev-user/.ssh", | ||
"type": "bind" | ||
} | ||
], | ||
// Tells devcontainer.json supporting services / tools whether they should run | ||
// /bin/sh -c "while sleep 1000; do :; done" when starting the container instead of the container’s default command | ||
"overrideCommand": false, | ||
"service": "django", | ||
// "remoteEnv": {"PATH": "/home/dev-user/.local/bin:${containerEnv:PATH}"}, | ||
"remoteUser": "dev-user", | ||
"workspaceFolder": "/app", | ||
// Set *default* container specific settings.json values on container create. | ||
"customizations": {}, | ||
// Uncomment the next line if you want start specific services in your Docker Compose config. | ||
// "runServices": [], | ||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down. | ||
// "shutdownAction": "none", | ||
// Uncomment the next line to run commands after the container is created. | ||
"postCreateCommand": "cat .devcontainer/bashrc.override.sh >> ~/.bashrc" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.editorconfig | ||
.gitattributes | ||
.github | ||
.gitignore | ||
.gitlab-ci.yml | ||
.idea | ||
.pre-commit-config.yaml | ||
.readthedocs.yml | ||
.travis.yml | ||
venv | ||
.git | ||
.envs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{py,rst,ini}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{html,css,scss,json,yml,xml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[default.conf] | ||
indent_style = space | ||
indent_size = 2 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
exclude: '^docs/|/migrations/' | ||
default_stages: [commit] | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-json | ||
exclude: .devcontainer/devcontainer.json | ||
- id: check-toml | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: detect-private-key | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.0.3 | ||
hooks: | ||
- id: prettier | ||
args: ['--tab-width', '2', '--single-quote'] | ||
exclude: 'cookie_cutter/templates/' | ||
|
||
- repo: https://github.com/adamchainz/django-upgrade | ||
rev: '1.15.0' | ||
hooks: | ||
- id: django-upgrade | ||
args: ['--target-version', '4.2'] | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py311-plus] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.9.1 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
|
||
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date | ||
ci: | ||
autoupdate_schedule: weekly | ||
skip: [] | ||
submodules: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: '3' | ||
|
||
services: | ||
django: | ||
build: | ||
context: . | ||
dockerfile: compose/django/Dockerfile | ||
image: djangocon_2024_local_django | ||
container_name: djangocon_2024_local_django | ||
volumes: | ||
- .:/app:z | ||
env_file: | ||
- ./.envs/.django | ||
ports: | ||
- '8000:8000' | ||
command: /start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# define an alias for the specific python version used in this file. | ||
FROM python:3.11.6-slim-bullseye as python | ||
|
||
# Python build stage | ||
FROM python as python-build-stage | ||
|
||
ARG BUILD_ENVIRONMENT=local | ||
|
||
# Install apt packages | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# dependencies for building Python packages | ||
build-essential \ | ||
# psycopg2 dependencies | ||
libpq-dev | ||
|
||
# Requirements are installed here to ensure they will be cached. | ||
COPY ./requirements . | ||
|
||
# Create Python Dependency and Sub-Dependency Wheels. | ||
RUN pip wheel --wheel-dir /usr/src/app/wheels \ | ||
-r ${BUILD_ENVIRONMENT}.txt | ||
|
||
|
||
# Python 'run' stage | ||
FROM python as python-run-stage | ||
|
||
ARG BUILD_ENVIRONMENT=local | ||
ARG APP_HOME=/app | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV BUILD_ENV ${BUILD_ENVIRONMENT} | ||
|
||
WORKDIR ${APP_HOME} | ||
|
||
|
||
# devcontainer dependencies and utils | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
sudo git bash-completion nano ssh | ||
|
||
# Create devcontainer user and add it to sudoers | ||
RUN groupadd --gid 1000 dev-user \ | ||
&& useradd --uid 1000 --gid dev-user --shell /bin/bash --create-home dev-user \ | ||
&& echo dev-user ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/dev-user \ | ||
&& chmod 0440 /etc/sudoers.d/dev-user | ||
|
||
|
||
# Install required system dependencies | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
# psycopg2 dependencies | ||
libpq-dev \ | ||
# Translations dependencies | ||
gettext \ | ||
# cleaning up unused files | ||
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction | ||
# copy python dependency wheels from python-build-stage | ||
COPY --from=python-build-stage /usr/src/app/wheels /wheels/ | ||
|
||
# use wheels to install python dependencies | ||
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \ | ||
&& rm -rf /wheels/ | ||
|
||
COPY ./compose/django/start /start | ||
RUN sed -i 's/\r$//g' /start | ||
RUN chmod +x /start | ||
|
||
# copy application code to WORKDIR | ||
COPY . ${APP_HOME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
|
||
python manage.py migrate | ||
exec python manage.py runserver_plus 0.0.0.0:8000 |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.