Skip to content

Commit a190b89

Browse files
authored
Merge branch 'main' into upgrade-poetry
2 parents 4432046 + 8dbac34 commit a190b89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1676
-71
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,7 @@ Session.vim
8383

8484
# Pycharm project modules
8585
.idea/
86+
87+
88+
### VSCode
89+
.vscode/

HISTORY.md

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,74 @@ History
22
----------------------
33
<small>Note: This file is autogenerated with [generate-history.sh](generate-history.sh)</small>
44

5-
### 2022-01-05
5+
### 2023-12-20
6+
- feat(fly-io): Added fly.io template files (#475) ([John Taylor])
67

7-
- Integrate poetry and update makefile commands. ([Sanyam Khurana])
8-
- Move isort/black config from .editorconfig to .pyproject.toml. ([Sanyam Khurana])
8+
### 2023-11-27
9+
- feat(async): add uvicorn, asgi, upgrade django=4.1 (#473) ([Suneet Choudhary])
910

10-
### 2022-01-11
11-
- Fix the use of letsencrypt tasks to run only on hosts configured with `use_letsencrypt`. ([Sanyam Khurana])
11+
### 2023-04-18
12+
- fix(docker): Fixed an issue with the Postgres Docker image name (#474) ([John Taylor])
13+
14+
### 2023-03-28
15+
- feat: add GraphQL API implementation using django-graphene (#449) ([Suneet Choudhary])
16+
17+
### 2023-03-03
18+
- fix(docker-start): Redirect access/error logs to std-out (#470) ([Sanyam Khurana])
19+
20+
### 2023-02-27
21+
- fix(Makefile): Update poetry export command to use --with option (#468) ([Sanyam Khurana])
22+
23+
### 2023-02-06
24+
- fix(compose): Use postgis protocol for connection (#467) ([Sanyam Khurana])
25+
26+
### 2023-01-06
27+
- feat(docker): Use GDAL/postgis when postgis is enabled (#464) ([Sanyam Khurana])
28+
29+
### 2022-12-15
30+
- Configure Renovate (#459) ([renovate[bot]])
31+
32+
### 2022-12-07
33+
- fix(users/api): Make code conformant to PEP8 ([Sanyam Khurana])
34+
- chore: Add docker-compose to run all services through docker (#440) ([Sanyam Khurana])
35+
36+
### 2022-10-27
37+
- fix(pyproject.toml): Add dependencies for mkdocs (#458) ([Sanyam Khurana])
38+
39+
### 2022-10-25
40+
- docs(README): Update docs to drop legacy poetry command (#457) ([Sanyam Khurana])
41+
- fix(github-actions): Use poetry to install requirements & run tests (#456) ([Sanyam Khurana])
42+
43+
### 2022-09-27
44+
- docs(coding_rules): correct class names to be PascalCase (#455) ([Sanyam Khurana])
45+
46+
### 2022-09-16
47+
- ci(github-actions): ensure poetry is installed lint action (#453) ([Sanyam Khurana])
48+
49+
### 2022-09-14
50+
- chore: make the relative and absolute imports consistent (#450) ([Sahith Chandan Mekala])
51+
- upgrade packages (#451) ([Sahith Chandan Mekala])
52+
53+
### 2022-06-18
54+
- upgrade(requirements): black 21.12b0 => 22.3.0 (#447) ([Akash Mishra])
55+
56+
### 2022-02-16
57+
- feat(setup): Add dependency management with poetry (#444) ([Sanyam Khurana])
58+
59+
### 2022-01-17
60+
- chore: update packages - celery, ansible (#445) ([Suneet Choudhary])
61+
62+
### 2022-01-13
63+
- fix(nginx/tasks): Run letsencrypt only for hosts with use_letsencrypt config (#446) ([Sanyam Khurana])
64+
65+
### 2022-01-04
66+
- Fix(API-docs): deprecated rest_framework_swagger (#441) ([Suneet Choudhary])
67+
68+
### 2021-12-17
69+
- feat: update python dependencies (#443) ([Saurabh Kumar])
70+
71+
### 2021-12-14
72+
- chore(CI): add python cache with pip ([Saurabh Kumar])
1273

1374
### 2021-12-07
1475
- chore: Update django-sites to 0.11 for Django 3.x (#442) ([Sanyam Khurana])

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
## Features
1414

15-
- Django 3.2.x
15+
- Django 4.1.x
1616
- Python 3.9.x
1717
- [Poetry][poetry] Support
1818
- Support for [black](https://pypi.org/project/black/)!
@@ -29,13 +29,15 @@
2929

3030
### Optional
3131
- Heroku Setup
32+
- Fly Setup
3233
- Ubuntu 20 LTS via [Ansible]
3334
- Celery with flower integration.
3435
- AWS S3 media storage
3536
- [Letsencrypt](https://letsencrypt.org/) Support via [certbot](https://certbot.eff.org).
3637
- Postgis Setup
3738
- Newrelic
3839
- Sentry
40+
- [GraphQL](https://graphql.org/) support via [Graphene-Django](https://docs.graphene-python.org/projects/django/en/latest/) (Optional)
3941
- pre-commit hooks
4042

4143

cookiecutter-test-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
default_context:
2+
enable_whitenoise: "y"
3+
add_celery: "y"
4+
add_graphql: "y"
5+
add_asgi: "y"

cookiecutter.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
, "add_newrelic" : "y"
1111
, "add_postgis": "n"
1212
, "add_heroku": "n"
13+
, "add_fly": "n"
1314
, "enable_whitenoise": "n"
1415
, "add_ansible": "y"
1516
, "letsencrypt": "y"
@@ -18,6 +19,8 @@
1819
, "add_sentry": "y"
1920
, "add_django_auth_wall": "y"
2021
, "add_celery": "n"
22+
, "add_graphql": "n"
23+
, "add_asgi": "n"
2124
, "add_pre_commit": "y"
2225
, "add_docker": "y"
2326
, "pagination": ["LimitOffsetPagination", "CursorPagination"]

hooks/post_gen_project.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ if echo "{{ cookiecutter.add_heroku }}" | grep -iq "^n"; then
2929
rm -rf uwsgi.ini Procfile bin/post_compile
3030
fi
3131

32+
if echo "{{ cookiecutter.add_fly }}" | grep -iq "^n"; then
33+
rm .github/workflows/fly.yml
34+
rm -rf compose/fly
35+
fi
36+
3237
if echo "{{ cookiecutter.add_ansible }}" | grep -iq "^n"; then
3338
rm -rf provisioner ansible.cfg
3439
fi
@@ -45,6 +50,18 @@ if echo "{{ cookiecutter.add_docker }}" | grep -iq "^n"; then
4550
rm -rf .envs compose local.yml dev.yml docs/backend/docker_setup.md
4651
fi
4752

53+
if echo "{{ cookiecutter.add_graphql }}" | grep -iq "^n"; then
54+
rm -rf {{ cookiecutter.main_module }}/graphql
55+
rm -rm {{ cookiecutter.main_module }}/docs/graphql
56+
rm -rf tests/graphql
57+
fi
58+
59+
if echo "{{ cookiecutter.add_asgi }}" | grep -iq "^n"; then
60+
rm -rf asgi.py
61+
else
62+
rm -rf wsgi.py
63+
fi
64+
4865
if echo "$yn" | grep -iq "^y"; then
4966
echo "==> Checking system dependencies. You may need to enter your sudo password."
5067

run_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919
rm -rf hello-world-backend/;
2020

2121
# Generate new code, (it also creates db, migrate and install dependencies)
22-
yes 'y' | cookiecutter . --no-input
22+
yes 'y' | cookiecutter . --no-input --config-file cookiecutter-test-config.yaml
2323

2424
# Run the tests present inside generate project
2525
cd hello-world-backend;

{{cookiecutter.github_repository}}/.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# DJANGO_AWS_S3_HOST=''
2929
# DJANGO_AWS_S3_REGION_NAME=''
3030

31-
# Django Rest Framework
31+
# APIs
3232
# ==============================
3333
# API_DEBUG=False
3434

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Fly Deploy
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
deploy:
8+
name: Deploy app
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: superfly/flyctl-actions/setup-flyctl@master
13+
- run: flyctl deploy --dockerfile ./compose/fly/django/Dockerfile
14+
env:
15+
FLY_API_TOKEN: ${{ "{{" }} secrets.FLY_API_TOKEN {{ "}}" }}

{{cookiecutter.github_repository}}/README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
{{ cookiecutter.project_name }}
2-
==============================
1+
# {{ cookiecutter.project_name }}
32

4-
__Version:__ {{ cookiecutter.version }}
3+
**Version:** {{ cookiecutter.version }}
54

65
{{ cookiecutter.project_description }}
76

87
## Getting up and running
98

109
{% if cookiecutter.add_docker == 'y' %}
1110
!!! note
12-
For setting up locally using `Docker`, check [here](docs/backend/docker_setup.md)
11+
For setting up locally using `Docker`, check [here](docs/backend/docker_setup.md)
1312
{% endif %}
1413

1514
Minimum requirements: **pip, python3.9, poetry, redis & [PostgreSQL 11][install-postgres]{% if cookiecutter.add_postgis.lower() == "y" %} with postgis-2.4{% endif %}**, setup is tested on Mac OSX only.
@@ -43,7 +42,7 @@ Running `poetry lock` generates `poetry.lock` which has all versions pinned.
4342

4443
You can install Poetry by using `pip install --pre poetry` or by following the official installation guide [here](https://github.com/python-poetry/poetry#installation).
4544

46-
*Tip:* We recommend that you use this workflow and keep `pyproject.toml` as well as `poetry.lock` under version control to make sure all computers and environments run exactly the same code.
45+
_Tip:_ We recommend that you use this workflow and keep `pyproject.toml` as well as `poetry.lock` under version control to make sure all computers and environments run exactly the same code.
4746

4847

4948
## Deploying Project
@@ -52,6 +51,32 @@ The deployment are managed via travis, but for the first time you'll need to set
5251

5352
Check out detailed server setup instruction [here](docs/backend/server_config.md).
5453

54+
{% if cookiecutter.add_fly == 'y' %}
55+
56+
### Develop on Fly.io
57+
58+
Create a [fly.io](https://fly.io) account.
59+
60+
Install `flyctl` and run the following commands to set up the Fly.io application, it will ask a series of questions regarding deployment configuration.
61+
62+
```
63+
brew install flyctl
64+
fly lauch
65+
```
66+
67+
When ready to deploy, simply run the command using the Fly Dockerfile:
68+
69+
```
70+
flyctl deploy --dockerfile ./compose/fly/django/Dockerfile
71+
```
72+
73+
There is also a Github Action provided `.github/workflows/fly.yml` to deploy the application on the `master` branch. In order to deploy from CI:
74+
75+
1. Create Fly Access Token [here](https://fly.io/user/personal_access_tokens).
76+
2. Add the `FLY_API_TOKEN` to the Github repo secrets [here](https://github.com/{{cookiecutter.github_username}}/{{cookiecutter.github_repository}}/settings/secrets/actions)
77+
78+
{% endif %}
79+
5580
## How to release {{ cookiecutter.project_name }}
5681

5782
Execute the following commands:

0 commit comments

Comments
 (0)