From 5ea29a913b7dfb20745dc90229536b1d2c032b04 Mon Sep 17 00:00:00 2001 From: Florian Eitel Date: Sun, 15 Jan 2023 12:47:06 +0100 Subject: [PATCH] Add DEVELOPMENT.md to list common development commands Update `./manage.py` to find application folder in `src/` instead of expecting a toplevel `nsupdate` folder. --- DEVELOPMENT.md | 12 ++++++++++++ manage.py | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 DEVELOPMENT.md diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..7f6f98f --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,12 @@ +# Build locally + +1. Install `build` (see [docs](https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives) for example via `pacman -S python-build` on ArchLinux +2. Afterwards run the command to generate pip packgases in `dist/`: `pyproject-build` + +NOTE: This is also needed before development because the command generates `./src/nsupdate/_version.py`. + +# Run locally + +1. Create database using `python ./manage.py migrate` +2. Create a superuser with `python ./manage.py createsuperuser` +2. Run the server with `python ./manage.py runserver` diff --git a/manage.py b/manage.py index 115fa21..4c686de 100755 --- a/manage.py +++ b/manage.py @@ -4,6 +4,9 @@ import sys if __name__ == "__main__": + PROJECT_ROOT = os.path.dirname(__file__) + sys.path.insert(0, os.path.join(PROJECT_ROOT, 'src')) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nsupdate.settings.dev") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)