Skip to content

Commit

Permalink
feat: restructure app
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee committed Sep 17, 2024
1 parent 097df08 commit 4005e7d
Show file tree
Hide file tree
Showing 990 changed files with 10,561 additions and 10,691 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ jobs:
cache-name: pythondotorg-cache-pip
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt', '*-requirements.txt') }}
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements/requirements.txt', 'requirements/*-requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
- name: Install Python dependencies
run: |
pip install -U pip setuptools wheel
pip install -r dev-requirements.txt
pip install -r requirements/dev-requirements.txt
- name: Check for ungenerated database migrations
run: |
python manage.py makemigrations --check --dry-run
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
cache-name: pythondotorg-cache-pip
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt', '*-requirements.txt') }}
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements/requirements.txt', 'requirements/*-requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
- name: Install Python dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt -r prod-requirements.txt
pip install -r requirements/requirements.txt -r requirements/prod-requirements.txt
- name: Run Tests
run: |
DJANGO_SETTINGS_MODULE=pydotorg.settings.static python manage.py collectstatic --noinput
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

.sass-cache/
docs/build
media/*
app/media/*
static-root/
static/stylesheets/mq.css
static/stylesheets/no-mq.css
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ build:
python: "3"

commands:
- python -m pip install -r docs-requirements.txt
- python -m pip install -r requirements/docs-requirements.txt
- make -C docs html JOBS=$(nproc) BUILDDIR=_readthedocs
- mv docs/_readthedocs _readthedocs
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ RUN case $(uname -m) in \
RUN mkdir /code
WORKDIR /code

COPY dev-requirements.txt /code/
COPY base-requirements.txt /code/
COPY prod-requirements.txt /code/
COPY requirements.txt /code/
COPY requirements/dev-requirements.txt /code/
COPY requirements/base-requirements.txt /code/
COPY requirements/prod-requirements.txt /code/
COPY requirements/requirements.txt /code/

RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel

Expand Down
10 changes: 5 additions & 5 deletions Dockerfile.cabotage
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ RUN case $(uname -m) in \
RUN mkdir /code
WORKDIR /code

COPY dev-requirements.txt /code/
COPY base-requirements.txt /code/
COPY prod-requirements.txt /code/
COPY requirements.txt /code/
COPY requirements/dev-requirements.txt /code/
COPY requirements/base-requirements.txt /code/
COPY requirements/prod-requirements.txt /code/
COPY requirements/requirements.txt /code/

RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel

Expand All @@ -46,4 +46,4 @@ RUN --mount=type=cache,target=/root/.cache/pip \
install \
-r requirements.txt -r prod-requirements.txt
COPY . /code/
RUN DJANGO_SETTINGS_MODULE=pydotorg.settings.static python manage.py collectstatic --noinput
RUN DJANGO_SETTINGS_MODULE=pydotorg.settings.static python app/manage.py collectstatic --noinput
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default:
@echo
@exit 1

.state/docker-build-web: Dockerfile dev-requirements.txt base-requirements.txt
.state/docker-build-web: Dockerfile requirements/dev-requirements.txt requirements/base-requirements.txt
# Build web container for this project
docker compose build --force-rm web

Expand All @@ -24,7 +24,7 @@ default:

.state/db-initialized: .state/docker-build-web .state/db-migrated
# Load all fixtures
docker compose run --rm web ./manage.py loaddata fixtures/*.json
docker compose run --rm web ./app/manage.py loaddata fixtures/*.json

# Mark the state so we don't rebuild this needlessly.
mkdir -p .state && touch .state/db-initialized
Expand All @@ -34,25 +34,25 @@ serve: .state/db-initialized

migrations: .state/db-initialized
# Run Django makemigrations
docker compose run --rm web ./manage.py makemigrations
docker compose run --rm web ./app/manage.py makemigrations

migrate: .state/docker-build-web
# Run Django migrate
docker compose run --rm web ./manage.py migrate
docker compose run --rm web ./app/manage.py migrate

manage: .state/db-initialized
# Run Django manage to accept arbitrary arguments
docker compose run --rm web ./manage.py $(filter-out $@,$(MAKECMDGOALS))
docker compose run --rm web ./app/manage.py $(filter-out $@,$(MAKECMDGOALS))

shell: .state/db-initialized
docker compose run --rm web ./manage.py shell
docker compose run --rm web ./app/manage.py shell

clean:
docker compose down -v
rm -f .state/docker-build-web .state/db-initialized .state/db-migrated

test: .state/db-initialized
docker compose run --rm web ./manage.py test
docker compose run --rm web ./app/manage.py test

docker_shell: .state/db-initialized
docker compose run --rm web /bin/bash
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
release: python manage.py migrate --noinput
release: python app/manage.py migrate --noinput
web: bin/start-nginx gunicorn -c gunicorn.conf pydotorg.wsgi
worker: celery -A pydotorg worker -l INFO
worker: celery -A app.pydotorg worker -l INFO
worker-beat: celery -A pydotorg beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion banners/admin.py → app/banners/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from banners.models import Banner
from app.banners.models import Banner


@admin.register(Banner)
Expand Down
2 changes: 1 addition & 1 deletion banners/apps.py → app/banners/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class BannersAppConfig(AppConfig):

name = 'banners'
name = 'app.banners'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django import template
from django.template.loader import render_to_string

from banners.models import Banner
from app.banners.models import Banner

register = template.Library()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion blogs/admin.py → app/blogs/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib import admin
from django.core.management import call_command

from .models import BlogEntry, Feed, FeedAggregate
from app.blogs.models import BlogEntry, Feed, FeedAggregate


@admin.register(BlogEntry)
Expand Down
2 changes: 1 addition & 1 deletion blogs/apps.py → app/blogs/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class BlogsAppConfig(AppConfig):

name = 'blogs'
name = 'app.blogs'
2 changes: 1 addition & 1 deletion blogs/factories.py → app/blogs/factories.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf import settings

from .models import Feed
from app.blogs.models import Feed


def initial_data():
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.core.management.base import BaseCommand
from django.utils.timezone import now

from ...models import BlogEntry, RelatedBlog, Feed
from ...parser import get_all_entries, update_blog_supernav
from app.blogs..models import BlogEntry, RelatedBlog, Feed
from app.blogs..parser import get_all_entries, update_blog_supernav


class Command(BaseCommand):
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion blogs/models.py → app/blogs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from django.db import models

from cms.models import ContentManageable
from app.cms.models import ContentManageable


def tag_visible(element):
Expand Down
4 changes: 2 additions & 2 deletions blogs/parser.py → app/blogs/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from django.template.loader import render_to_string
from django.utils.timezone import make_aware

from boxes.models import Box
from .models import BlogEntry, Feed
from app.boxes.models import Box
from app.blogs.models import BlogEntry, Feed


def get_all_entries(feed_url):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import template

from ..models import BlogEntry
from app.blogs.models import BlogEntry

register = template.Library()

Expand Down
File renamed without changes.
Loading

0 comments on commit 4005e7d

Please sign in to comment.