Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from cookiecutter:master #733

Merged
merged 11 commits into from
Mar 31, 2024
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
args: ["--tab-width", "2"]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py312-plus]
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,33 @@ All enhancements and patches to Cookiecutter Django will be documented in this f

<!-- GENERATOR_PLACEHOLDER -->

## 2024.03.29


### Documentation

- Add instruction for adding a django app ([#4944](https://github.com/cookiecutter/cookiecutter-django/pull/4944))

## 2024.03.27


### Updated

- Update pre-commit to 3.7.0 ([#4943](https://github.com/cookiecutter/cookiecutter-django/pull/4943))

- Update djangorestframework to 3.15.1 ([#4941](https://github.com/cookiecutter/cookiecutter-django/pull/4941))

- Update ruff to 0.3.4 ([#4936](https://github.com/cookiecutter/cookiecutter-django/pull/4936))

- Auto-update pre-commit hooks ([#4937](https://github.com/cookiecutter/cookiecutter-django/pull/4937))

## 2024.03.26


### Documentation

- Update mentions of psycopg in comments ([#4947](https://github.com/cookiecutter/cookiecutter-django/pull/4947))

## 2024.03.21


Expand Down
55 changes: 55 additions & 0 deletions docs/developing-locally.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,61 @@ First things first.
.. _direnv: https://direnv.net/


Creating Your First Django App
-------------------------------

After setting up your environment, you're ready to add your first app. This project uses the setup from "Two Scoops of Django" with a two-tier layout:

- **Top Level Repository Root** has config files, documentation, `manage.py`, and more.
- **Second Level Django Project Root** is where your Django apps live.
- **Second Level Configuration Root** holds settings and URL configurations.

The project layout looks something like this: ::

<repository_root>/
├── config/
│ ├── settings/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── local.py
│ │ └── production.py
│ ├── urls.py
│ └── wsgi.py
├── <django_project_root>/
│ ├── <name_of_the_app>/
│ │ ├── migrations/
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── models.py
│ │ ├── tests.py
│ │ └── views.py
│ ├── __init__.py
│ └── ...
├── requirements/
│ ├── base.txt
│ ├── local.txt
│ └── production.txt
├── manage.py
├── README.md
└── ...


Following this structured approach, here's how to add a new app:

#. **Create the app** using Django's ``startapp`` command, replacing ``<name-of-the-app>`` with your desired app name: ::

$ python manage.py startapp <name-of-the-app>

#. **Move the app** to the Django Project Root, maintaining the project's two-tier structure: ::

$ mv <name-of-the-app> <django_project_root>/

#. **Edit the app's apps.py** change ``name = '<name-of-the-app>'`` to ``name = '<django_project_root>.<name-of-the-app>'``.

#. **Register the new app** by adding it to the ``LOCAL_APPS`` list in ``config/settings/base.py``, integrating it as an official component of your project.



Setup Email Backend
-------------------

Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ binaryornot==0.4.4

# Code quality
# ------------------------------------------------------------------------------
ruff==0.3.3
ruff==0.3.4
django-upgrade==1.16.0
djlint==1.34.1
pre-commit==3.6.2
pre-commit==3.7.0

# Testing
# ------------------------------------------------------------------------------
tox==4.14.1
tox==4.14.2
pytest==8.1.1
pytest-xdist==3.5.0
pytest-cookies==0.7.0
Expand All @@ -20,7 +20,7 @@ pyyaml==6.0.1

# Scripting
# ------------------------------------------------------------------------------
PyGithub==2.2.0
PyGithub==2.3.0
gitpython==3.1.42
jinja2==3.1.3
requests==2.31.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from distutils.core import setup

# We use calendar versioning
version = "2024.03.21"
version = "2024.03.29"

with open("README.md") as readme_file:
long_description = readme_file.read()
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:

# Run the Ruff linter.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
rev: v0.3.4
hooks:
# Linter
- id: ruff
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/compose/local/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG BUILD_ENVIRONMENT=local
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
# psycopg dependencies
libpq-dev

# Requirements are installed here to ensure they will be cached.
Expand Down Expand Up @@ -47,7 +47,7 @@ RUN groupadd --gid 1000 dev-user \

# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
# psycopg2 dependencies
# psycopg dependencies
libpq-dev \
# Translations dependencies
gettext \
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/compose/local/docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV PYTHONDONTWRITEBYTECODE 1
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
# psycopg dependencies
libpq-dev \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
Expand All @@ -35,7 +35,7 @@ ENV PYTHONDONTWRITEBYTECODE 1
RUN apt-get update && apt-get install --no-install-recommends -y \
# To run the Makefile
make \
# psycopg2 dependencies
# psycopg dependencies
libpq-dev \
# Translations dependencies
gettext \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ARG BUILD_ENVIRONMENT=production
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
# psycopg dependencies
libpq-dev

# Requirements are installed here to ensure they will be cached.
Expand Down Expand Up @@ -65,7 +65,7 @@ RUN addgroup --system django \

# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
# psycopg2 dependencies
# psycopg dependencies
libpq-dev \
# Translations dependencies
gettext \
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ django-compressor==4.4 # https://github.com/django-compressor/django-compressor
django-redis==5.4.0 # https://github.com/jazzband/django-redis
{%- if cookiecutter.use_drf == 'y' %}
# Django REST Framework
djangorestframework==3.15.0 # https://github.com/encode/django-rest-framework
djangorestframework==3.15.1 # https://github.com/encode/django-rest-framework
django-cors-headers==4.3.1 # https://github.com/adamchainz/django-cors-headers
# DRF-spectacular for api documentation
drf-spectacular==0.27.1 # https://github.com/tfranzel/drf-spectacular
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ sphinx-autobuild==2024.2.4 # https://github.com/GaretJax/sphinx-autobuild

# Code quality
# ------------------------------------------------------------------------------
ruff==0.3.3 # https://github.com/astral-sh/ruff
ruff==0.3.4 # https://github.com/astral-sh/ruff
coverage==7.4.4 # https://github.com/nedbat/coveragepy
djlint==1.34.1 # https://github.com/Riverside-Healthcare/djLint
pre-commit==3.6.2 # https://github.com/pre-commit/pre-commit
pre-commit==3.7.0 # https://github.com/pre-commit/pre-commit

# Django
# ------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3-dev
##Pillow, pylibmc
zlib1g-dev

##Postgresql and psycopg2 dependencies
##Postgresql and psycopg dependencies
libpq-dev

##Pillow dependencies
Expand Down