Caution
This app is not meant to be used in production, it's just a playground to test Django feature or create POC.
License: MIT
- User Authentication with allauth
- Bootstrap 5
- Docker
- Sphinx
- Sample App: Stock
- Asynchronous tasks with Celery and RabbitMQ
- Poetry as package manager.
- Pyenv to manage python versions.
- Pyenv-virtualenv to manage virtual environments.
- Flower to monitor celery tasks.
- Prometheus to monitor the application.
To be implemented - Grafana to visualize prometheus metrics.
To be implemented
- docker to run the project in a container.
- docker-compose to manage multiple containers.
- pre-commit to run linters and formatters before commiting.
- sphinx to generate documentation.
This project is intended to be used with Docker and Docker Compose.
docker compose -f compose.local.yaml upsudo apt-get install -y build-essential curl graphviz graphviz-dev libpq-dev// TODO
It's recommended to use a virtual environment to avoid conflicts with other projects.
pyenv install 3.12.5
pyenv virtualenv 3.12.5 django-playground
pyenv local django-playground-3.12.5
poetry installA default superuser is created with the following credentials
Email : admin@admin.local
Password : admin
-
To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
-
To create a superuser account, use this command:
$ docker compose -f compose.local.yaml run --rm django python manage.py createsuperuser
For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
docker compose -f compose.local.yaml updocker compose -f compose.local.yaml run --rm django python manage.py manage.py loaddata --app=stocks products| Service | URL |
|---|---|
| Django | http://localhost:8000 |
| Flower | http://localhost:5555 |
| RabbitMQ | http://localhost:15672 |
Moved to settings.
See detailed cookiecutter-django Docker documentation.
The initial dataset is from https://dummyjson.com/products?
To import the data:
docker compose -f compose.local.yaml run --rm django python manage.py loaddata --app=stocks products```
To dump the data:
```bash
docker compose -f compose.local.yaml run --rm django python manage.py dumpdata stocks.Product -o "django_playground/stocks/fixtures/products.json" --indent 4Running type checks with mypy:
$ mypy django_playground
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html
$ pytest
$ docker compose -f compose.local.yaml run --rm django python manage.py visualizemigrations .graphs/migration.gv
Moved to Live reloading and SASS compilation.