Skip to content

Commit 319f42a

Browse files
authored
Change backend to use Django Rest Framework (#179)
* Change backend to use Django & DRF * Remove old files * Use binary version of psycopg locally * Use local.yml for now * Linter updates for py11
1 parent ef3643d commit 319f42a

File tree

253 files changed

+4700
-18595
lines changed

Some content is hidden

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

253 files changed

+4700
-18595
lines changed

.cruft.json

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
{
2-
"template": "https://github.com/gaganpreet/fastapi-starter",
3-
"commit": "dac633162dd7d021a117d6da0376db26dbf0c770",
2+
"template": "https://github.com/cookiecutter/cookiecutter-django",
3+
"commit": "4ef180edb118ddf650261db8889c2b4704cab3a5",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
7-
"project_name": "AMI Data Manager",
7+
"project_name": "Automated Monitoring of Insects ML Platform",
88
"project_slug": "ami",
9-
"backend_port": "8000",
10-
"frontend_port": "3000",
11-
"_copy_without_render": [
12-
"*node_modules",
13-
"*src/App.tsx",
14-
"*pages/ProfileEdit.tsx"
15-
],
16-
"_template": "https://github.com/gaganpreet/fastapi-starter"
9+
"description": "Platform for processing and reviewing images from automated insect monitoring statoins using deep learning.",
10+
"author_name": "Rolnick Lab",
11+
"domain_name": "app.insectai.org",
12+
"email": "[email protected]",
13+
"version": "0.1.0",
14+
"open_source_license": "MIT",
15+
"username_type": "email",
16+
"timezone": "UTC",
17+
"windows": "n",
18+
"use_pycharm": "n",
19+
"use_docker": "y",
20+
"postgresql_version": "14",
21+
"cloud_provider": "AWS",
22+
"mail_service": "Mailgun",
23+
"use_async": "y",
24+
"use_drf": "y",
25+
"frontend_pipeline": "None",
26+
"use_celery": "y",
27+
"use_mailhog": "y",
28+
"use_sentry": "y",
29+
"use_whitenoise": "y",
30+
"use_heroku": "n",
31+
"ci_tool": "Github",
32+
"keep_local_envs_in_vcs": "y",
33+
"debug": "n",
34+
"_template": "https://github.com/cookiecutter/cookiecutter-django"
1735
}
1836
},
1937
"directory": null

.dockerignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
frontend/node_modules/
1+
.editorconfig
2+
.gitattributes
3+
.github
4+
.gitignore
5+
.gitlab-ci.yml
6+
.idea
7+
.pre-commit-config.yaml
8+
.readthedocs.yml
9+
.travis.yml
10+
venv
11+
.git

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{py,rst,ini}]
12+
indent_style = space
13+
indent_size = 4
14+
15+
[*.{html,css,scss,json,yml,xml}]
16+
indent_style = space
17+
indent_size = 2
18+
19+
[*.md]
20+
trim_trailing_whitespace = false
21+
22+
[Makefile]
23+
indent_style = tab
24+
25+
[default.conf]
26+
indent_style = space
27+
indent_size = 2

.envs/.local/.django

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# General
2+
# ------------------------------------------------------------------------------
3+
USE_DOCKER=yes
4+
IPYTHONDIR=/app/.ipython
5+
# Redis
6+
# ------------------------------------------------------------------------------
7+
REDIS_URL=redis://redis:6379/0
8+
9+
# Celery
10+
# ------------------------------------------------------------------------------
11+
12+
# Flower
13+
CELERY_FLOWER_USER=QSocnxapfMvzLqJXSsXtnEZqRkBtsmKT
14+
CELERY_FLOWER_PASSWORD=BEQgmCtgyrFieKNoGTsux9YIye0I7P5Q7vEgfJD2C4jxmtHDetFaE2jhS7K7rxaf

.envs/.local/.postgres

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# PostgreSQL
2+
# ------------------------------------------------------------------------------
3+
POSTGRES_HOST=postgres
4+
POSTGRES_PORT=5432
5+
POSTGRES_DB=ami
6+
POSTGRES_USER=xekSryPnqczJXkOnTAeDmDyIapSRrGEE
7+
POSTGRES_PASSWORD=gyh3WMCrNgt1ArgqaqLtsJzHa3bRyfh5dv4M8QKbGs6QSKn4sL1VviE7lQAgEZsn

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.github/dependabot.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ updates:
33
- package-ecosystem: "github-actions"
44
directory: "/"
55
schedule:
6-
interval: "weekly"
6+
interval: "monthly"
77

88
- package-ecosystem: "npm"
99
directory: "/frontend/"
1010
schedule:
11-
interval: "weekly"
11+
interval: "monthly"
1212

1313
- package-ecosystem: "docker"
1414
directory: "/frontend/"
1515
schedule:
16-
interval: "weekly"
16+
interval: "monthly"
1717

1818
- package-ecosystem: "docker"
1919
directory: "/backend/"
2020
schedule:
21-
interval: "weekly"
21+
interval: "monthly"
2222

2323
- package-ecosystem: "docker"
2424
directory: "/"
2525
schedule:
26-
interval: "weekly"
26+
interval: "monthly"
2727

2828
- package-ecosystem: "pip"
2929
directory: "/backend/"
3030
schedule:
31-
interval: "weekly"
31+
interval: "monthly"

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
# Enable Buildkit and let compose use it to speed up image building
4+
env:
5+
DOCKER_BUILDKIT: 1
6+
COMPOSE_DOCKER_CLI_BUILD: 1
7+
8+
on:
9+
pull_request:
10+
branches: ['master', 'main']
11+
paths-ignore: ['docs/**']
12+
13+
push:
14+
branches: ['master', 'main']
15+
paths-ignore: ['docs/**']
16+
17+
concurrency:
18+
group: ${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
linter:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout Code Repository
26+
uses: actions/checkout@v3
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: '3.11'
32+
# Consider using pre-commit.ci for open source project
33+
- name: Run pre-commit
34+
uses: pre-commit/[email protected]
35+
36+
# With no caching at all the entire ci process takes 4m 30s to complete!
37+
pytest:
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- name: Checkout Code Repository
42+
uses: actions/checkout@v3
43+
44+
- name: Build the Stack
45+
run: docker-compose -f local.yml build
46+
47+
- name: Run DB Migrations
48+
run: docker-compose -f local.yml run --rm django python manage.py migrate
49+
50+
- name: Run Django Tests
51+
run: docker-compose -f local.yml run django pytest
52+
53+
- name: Tear down the Stack
54+
run: docker-compose -f local.yml down

.github/workflows/pre-commit.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/test.yaml

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)