Skip to content

Commit

Permalink
switch to UV, bump the deps, move the book app to the root
Browse files Browse the repository at this point in the history
  • Loading branch information
astynax committed Nov 2, 2024
1 parent 55f112b commit 071d8bf
Show file tree
Hide file tree
Showing 42 changed files with 161 additions and 962 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MANAGE := poetry run python manage.py
MANAGE := uv run python manage.py

run:
$(MANAGE) runserver
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ This project is a software that I'am developing during [this series of YouTube s

### How to

1. Get [poetry](https://python-poetry.org/).
1. Clone.
1. `poetry install`.
1. `poetry run python manage.py migrate`.
1. `poetry run python manage.py createsuperuser --username=admin` and set password to `admin` (TODO: make the password optional).
1. `poetry run python manage.py runserver`.
1. Get UV
1. Clone
1. `uv sync`
1. `uv run python manage.py migrate`.
1. `uv run python manage.py createsuperuser --username=admin` and set password to `admin` (TODO: make the password optional).
1. `uv run python manage.py runserver`.

### DB Example

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion djaif/book/admin.py → book/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from djaif.book import models
from . import models


class Admin(admin.ModelAdmin):
Expand Down
2 changes: 1 addition & 1 deletion djaif/book/apps.py → book/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class BookConfig(AppConfig):
name = 'djaif.book'
name = 'book'
2 changes: 1 addition & 1 deletion djaif/book/book_map.py → book/book_map.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from graphviz import Digraph

from djaif.book import models
from . import models


def book_map(book):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion djaif/book/models.py → book/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Book(models.Model):
title = models.CharField(name='title', max_length=100, unique=True)
first_page = models.ForeignKey(
'BookPage', null=True, on_delete=models.SET_NULL,
'BookPage', null=True, blank=True, on_delete=models.SET_NULL,
related_name='first_name',
)
cover_art = models.ImageField(null=True, blank=True)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion djaif/book/urls.py → book/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.urls import path

from djaif.book import views
from . import views


urlpatterns = [
path('', views.view_books),
Expand Down
2 changes: 1 addition & 1 deletion djaif/book/views.py → book/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse

from djaif.book import book_map, models
from . import book_map, models


def _return_to(book_id):
Expand Down
9 changes: 2 additions & 7 deletions djaif/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

DJANGO_SETTINGS_MODULE = 'djaif.settings'

SECRET_KEY = os.getenv('SECRET_KEY')
DEBUG = bool(os.getenv('DEBUG'))
SUPERUSER = os.getenv('SUPERUSER', 'admin')
PASSWORD = os.getenv('PASSWORD', 'admin')

ALLOWED_HOSTS = []
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', [])


# Application definition
Expand All @@ -31,7 +26,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'djaif.book',
'book',
]

MIDDLEWARE = [
Expand Down
2 changes: 1 addition & 1 deletion djaif/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
from django.urls import include, path

urlpatterns = [
path('', include('djaif.book.urls')),
path('', include('book.urls')),
path('admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Loading

0 comments on commit 071d8bf

Please sign in to comment.