Skip to content

Commit

Permalink
[Backend] : Improvements (#574)
Browse files Browse the repository at this point in the history
* move some files

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add

* Better logs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* God knows why i tried celery

Fuck celery

* fix some

* Update populate_characters.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* rename

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix staff

* more fix

* refractor

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Create populate_staff.py

* add

* add

* Create .gitignore

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* addd

* Update populate_staff.py

Add colors

* remove

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update populate_staff.py

* Update populate_staff.py

* Update populate_staff.py

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* more fixes

* add

* .

* ,,

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update populate_staff.py

* better :D

* update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix math

* Switch to custom `storage`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update __init__.py

* more work

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update storages.py

* Update populate_characters.py

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update populate_staff.py

* A bit of rework

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refractorr

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Some fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update populate_staffs.py

* Update .pre-commit-config.yaml

* Update .pre-commit-config.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add

* Update populate_characters.py

Apply suggestion from jikan-me/jikan#475 (comment)

* Update populate_characters.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update populate_characters.py

* Refractor

* add

* Add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

Got The following Output

```typescript
{
  "items": [
    {
      "mal_id": 1,
      "kitsu_id": 22301,
      "anilist_id": 152638,
      "name": "Erina Seki",
      "given_name": "智一",
      "family_name": "関",
      "staff_image": "/media/staff/22301.jpg",
      "about": "Hometown: Tokyo, Japan\nBlood type: AB\n\nTwitter: @seki0908",
      "alternate_names": [
        "Seki Mondoya",
        "門戸 開",
        "Monto Hiraku"
      ]
    }
  ],
  "count": 1
}
```

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update schemas.py

* Update __init__.py

* Fully typed

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* More type coverage

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update episode.py

* More fixes

* add

* forget it

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Bump @sveltejs/kit in /frontend/AnimeCore

Bumps [@sveltejs/kit](https://github.com/sveltejs/kit/tree/HEAD/packages/kit) from 1.0.0-next.476 to 1.0.0-next.477.
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/[email protected]/packages/kit)

---
updated-dependencies:
- dependency-name: "@sveltejs/kit"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add lock file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* Update pyproject.toml

* Update pyproject.toml

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update package-lock.json

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update urls.py

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update populate_characters.py

* add

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyproject.toml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use Streaming HTTP Response

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* finish

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update views.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* use aiohttp to serve media

* add files

* refractor

* fix

* .

* reuse django template

* add

* move files

* Fix monorepo

* fix

* fix aiohttp

* Fix

* fixes

* add

* fix

* Update avatar.py

* Update Pipfile

* add

* add

* add

* Add

* Update managers.py

* Update avatar.py

* Update models.py

* Partial work on #545

* use DRY

* More CodeQL

* final fix

* Update populate_characters.py

* better logics

* add

* fix

* BETTER LOGICS

* final logic

* Fix

* Finally remove requests

fuck requests

* update

* add

* Fix

* Add

* Fix

* Fixxx

* add

* add

* Partial work

* Name `AioHttp` `Butler`

* Update ARCHITECTURE.rst

* Create TODO

* Add

* AutoFlake

* Delete package-lock.json

Signed-off-by: baseplate-admin <[email protected]>

* Update package.json

Signed-off-by: baseplate-admin <[email protected]>

* Create package-lock.json

Signed-off-by: baseplate-admin <[email protected]>

* Rename

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* more renaming

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dependabot.yml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add

* Update user.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix ?

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Yes async stuff woo

* Maybe add a view

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: baseplate-admin <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 28, 2022
1 parent 767956d commit e59a5bd
Show file tree
Hide file tree
Showing 214 changed files with 13,436 additions and 3,015 deletions.
3 changes: 2 additions & 1 deletion backend/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"pylint_django",
"--django-settings-module",
"core.settings"
]
],
"restructuredtext.preview.name": "docutils"
}
11 changes: 11 additions & 0 deletions backend/ARCHITECTURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. list-table:: Structure
:header-rows: 1

* - Codebase
- Description
* - `Tsukaeru`_
- AioHTTP ( Proxy | Media )



.. _Tsukaeru: https://github.com/baseplate-admin/CoreProject/tree/master/backend/tsukaeru
46 changes: 29 additions & 17 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,46 @@ verify_ssl = true
name = "pypi"

[packages]
django = {version = "~=4.1", extras = ["argon2"]}
django = {version = ">=4.1", extras = ["argon2"]}
# Postgres
psycopg2 = "*"
# 3rd Party ( Middlewares )
django_cleanup = "*"
django_cors_headers = "*"
# 3rd party ( Management )
django_click = "*"
# 3rd Party ( ENV )
python_dotenv = "*"
# 3rd Party ( WhiteNoise )
whitenoise = {extras = ["brotli"], version = "*"}
# 3rd Party ( Tasks )
huey = "*"
redis = "*"
redis = ">=4"
hiredis = {version="*", markers="sys_platform != 'win32'"}
# Rest framework
django_ninja = "*"
# Remove when
# https://github.com/vitalik/django-ninja/issues/305
django-ninja-jwt = "*"
# ===================================================
# HTTP Client
requests = "*"
requests_cache = "*"
requests_ratelimiter = "*"
aiohttp = {version=">=3.8,<4", extras=['speedups']}
aiohttp_jinja2 = '*'
sqlalchemy = {extras = ["postgresql_asyncpg"], version = "*"}
# HTTP Client Enhancements
aiohttp_retry = "*"
aiohttp_client_cache = {extras = ["redis"], version = "*"}
pyrate-limiter = {extras = ["redis"], version = "*"}
# Web servers
gunicorn = {extras = ["setproctile"], version = "*"}
uvicorn = {extras = ["standard"], version = "*"}
# Image processing
pillow = "*"
# Discord API
"discord.py" = {extras = ["voice","speed"], version = "*"}
"discord.py" = {extras = ["voice", "speed"], version = "*"}

[dev_packages]
[dev-packages]
# Aiohttp
aiohttp-devtools = "*"
# Django
django_debug_toolbar = "*"
django_dbbackup = "*"
django_cprofile_middleware = "*"
Expand All @@ -44,29 +52,33 @@ django_cprofile_middleware = "*"
black = "*"
# Flake8
flake8 = "*"
# AutoFlake
autoflake = "*"
# Pylint
pylint = "*"
pylint_django = "*"
# Mypy
mypy = "*"
types_requests = "*"
types_redis = "*"
django_stubs = {extras = ["compatible_mypy"], version = "*"}

[requires]
python_version = "3.10"

[scripts]
## Server
dev = "python manage.py runserver"
prod = "gunicorn core.asgi:application -w 4 -k uvicorn.workers.UvicornWorker" # For linux only
## Dev Servers
dev_django = "python ./django_core/manage.py runserver 0.0.0.0:8003"
dev_aiohttp = 'adev runserver ./tsukaeru/server.py --app-factory=aiohttp_app'
## Prod servers
prod_uvicorn = "gunicorn django_core/core.asgi:application -w 4 -k uvicorn.workers.UvicornWorker" # For linux only
prod_aiohttp = "gunicorn tsukaeru.server:aiohttp_app -w 4 --bind localhost:8001 --worker-class aiohttp.GunicornUVLoopWebWorker" # We want to run this without any proxy or anything
## Migrations
sync = "python manage.py migrate"
mksync = "python manage.py makemigrations"
sync = "python ./django_core/manage.py migrate"
mksync = "python ./django_core/manage.py makemigrations"
## Task queue
huey = "python manage.py run_huey"
huey = "python ./django_core/manage.py run_huey"
## Staticfiles
collectstatic = "python manage.py collectstatic --clear --link" # Dont duplicate copy files.
collectstatic = "python ./django_core/manage.py collectstatic --clear --link" # Dont duplicate copy files.

[pipenv]
allow_prereleases = true
1,434 changes: 1,149 additions & 285 deletions backend/Pipfile.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions backend/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Take login inspiration from => https://www.pixiv.net/en/
44 changes: 0 additions & 44 deletions backend/apps/anime/admin/episode_comment.py

This file was deleted.

44 changes: 0 additions & 44 deletions backend/apps/anime/admin/episode_timestamp.py

This file was deleted.

7 changes: 0 additions & 7 deletions backend/apps/characters/admin.py

This file was deleted.

Loading

1 comment on commit e59a5bd

@vercel
Copy link

@vercel vercel bot commented on e59a5bd Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.