Skip to content

i-dot-ai/django-history-example

Repository files navigation

django-history-example

About this project

This is an example project to test the functionality of django-simple-history.

This uses Django with a SQLite database (for simplicity).

Setup

This project uses:

Make sure you have Python >= 3.12, poetry and precommit installed on your laptop. Then run poetry install to install relevant packages.

For linting and formatting: make check-python-code and make format-python-code. See the Makefile for more details (make help).

Setting up the app

  1. Clone the repo.
  2. Run the migrations (which will create your SQLite database): poetry run python manage.py migrate.
  3. Run the app: make run.
  4. Go to http://localhost:8000 in the browser.

Exploring the data

Explore in the shell: poetry run python manage.py shell.

Populating the app with dummy data

There is a management command to populate the database with dummy data on responses and users: poetry run python manage.py generate_dummy_users_responses.

## Creating users

Create a superuser using poetry run python manage.py createsuperuser.

Create a regular user in the shell. To access the Django shell: poetry run python manage.py shell.

Running the app

If you make database changes you will need to make migrations (poetry run python manage.py makemigrations) and run migrations (poetry run python manage.py migrate).

Then make run to run the app and go to http://localhost:8000 in the browser. You will need to create a superuser to login.

Go to http://localhost:8000/api/docs to see the API docs.

About

Repo to test functionality of django-simple-history.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published