-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the template project compatible with startproject (#20)
Adds the necessary place holders for ensuring the `template` project can be used with the Django `startproject` command. - Placeholders added to template file (mostly `{{ project_name }}`) - Really basic usage example in README - Github action workflow to ensure that the repository is capable of creating a valid project The Github action workflow `startproject` performs the following to ensure that we can create a valid project from this repositoiry: 1. Checkout code 2. Install Django. Poetry and Invoke 3. Run the `startproject` Django command specifying the `template` directory as the source 4. Poetry install the project created in the previous step 5. Run `invoke check` on the project - which runs all the static analysis, linting and tests Closes #19
- Loading branch information
Showing
17 changed files
with
142 additions
and
23 deletions.
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,90 @@ | ||
name: Start Project | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
# Restrict jobs in this workflow to have no permissions by default; permissions | ||
# should be granted per job as needed using a dedicated `permissions` block | ||
permissions: {} | ||
|
||
jobs: | ||
creates-valid-project: | ||
permissions: | ||
contents: read | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres:14 | ||
env: | ||
POSTGRES_USER: dev | ||
POSTGRES_PASSWORD: dev_password | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Allows us to use the same env config used locally by mapping to port to | ||
# the test runner container. | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
# Project System Dependencies | ||
sudo apt-get install -y \ | ||
build-essential \ | ||
libffi-dev \ | ||
libpq-dev | ||
# Playwright System Dependencies | ||
sudo apt-get install -y \ | ||
libnss3\ | ||
libnspr4\ | ||
libatk1.0-0\ | ||
libatk-bridge2.0-0\ | ||
libcups2\ | ||
libdrm2\ | ||
libxkbcommon0\ | ||
libatspi2.0-0\ | ||
libxcomposite1\ | ||
libxdamage1\ | ||
libxfixes3\ | ||
libxrandr2\ | ||
libgbm1\ | ||
libasound2 | ||
# Base Python tooling | ||
pip install poetry django | ||
- name: Create test project | ||
run: | | ||
django-admin startproject \ | ||
--template template/ \ | ||
--extension py,Dockerfile,env,toml,yml \ | ||
test_project | ||
- name: Install test project | ||
run: | | ||
cd test_project | ||
poetry install | ||
poetry run playwright install | ||
- name: Check test project is valid | ||
run: | | ||
cd test_project | ||
cp example.env .env | ||
poetry run invoke check |
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
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
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
[tool.poetry] | ||
authors = ["Jonathan Moss <[email protected]>"] | ||
description = "" | ||
name = "django-template" | ||
packages = [{include = "django_template", from = "src"}] | ||
name = "{{ project_name }}" | ||
packages = [{include = "{{ project_name }}", from = "src"}] | ||
readme = "README.md" | ||
version = "0.1.0" | ||
|
||
[tool.poetry.scripts] | ||
manage = "django_template.manage:main" | ||
manage = "{{ project_name }}.manage:main" | ||
|
||
[tool.poetry.dependencies] | ||
django = "^4.2.7" | ||
|
@@ -67,13 +67,13 @@ ignore_missing_imports = true | |
module = "environ" | ||
|
||
[tool.django-stubs] | ||
django_settings_module = "django_template.main.settings" | ||
django_settings_module = "{{ project_name }}.main.settings" | ||
|
||
[tool.isort] | ||
profile = "black" | ||
|
||
[tool.pytest.ini_options] | ||
DJANGO_SETTINGS_MODULE = "django_template.main.settings" | ||
DJANGO_SETTINGS_MODULE = "{{ project_name }}.main.settings" | ||
addopts = "--rootdir src --spec" | ||
norecursedirs = ".git .venv docs data" | ||
spec_header_format = "{test_case} [{module_path}]:" | ||
|
File renamed without changes.
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
File renamed without changes.
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
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