-
Notifications
You must be signed in to change notification settings - Fork 2
Power Cable Included: What comes with SOS Django Template?
SOS Django Template comes with widely used and useful 3rd-party dependencies and preconfigured them to be instantly used by you. You can check out the list here.
SOS Django Template comes with development dependencies shown below:
- Pytest Django: This project integrates Pytest with Django. Pytest is a widely used testing solution in Python community and comes with more useful features than standard and built-in solutions such as fixture, sessioning, parametrizing, raw assertion, human-readable output and stuff like these.
-
Pytest Factoryboy: This project lets you create model instances in your test easily and as a pytest fixture. For instance, you've got a model named
Foo
, you can get an instance of it by usingfoo
as a parameter orfoo_factory
fixture lets you create it in test quite easily. - Pytest PUDB: This is an integration of Pytest with PUDB. PUDB is a debugger to further investigate the memory.
- Black: Black is a great code formatter. It keeps your code in a readable format.
- isort: isort is an import sorting solution to keep your imports in a clean order.
- pre-commit: pre-commit makes it easier to add hooks that you run before you commit. SOS Django Template already configured it for you, so whenever you commit, pre-commit runs black and isort on staged files and formats them for you.
- Flake8 Django: Flake8 linter integrated into Django, warning you about some situations.
- ipython: iPython is a very advanced Python shell on terminal with colors and autocomplete on tab.
- Django Debug Toolbar: DDT is a debug toolbar residing at the right side of your web pages (only in development phase) to see various information about the request such as how much time it took to render, how many SQL queries were made, request information etc.
SOS Django Template comes with production dependencies shown below:
- Django Rest Framework: Django Rest Framework is a fully-featured REST framework solution, not only providing the serialization of data to many types (JSON or XML), but also providing a solid foundation on authorization, authentication, caching, throttling, routing, pagination, filtering etc.
- Celery: Celery is a asynchronous task queue tool with task scheduling support.
-
Environs: Environs is a
.env
utility to define and use environment variables to run the application. - Django Extensions: Django Extensions is a mix of utilities including custom commands, fields, admin extensions etc.
In order to use pytest-pudb
, you need to pass --pudb
flag to your pytest command.
You need to do pre-commit install
while you set up SOS Django Template. However, pre-commit is optional, so you won't have to do that.
That's because, in SOS Django Template, pre-commit is configured to use black and isort, which formats your source files. The solution is to add the same files and do a commit again:
# what you did
git add foo/models.py
git commit
# fails
# do again
git add foo/models.py # do again
git commit # do again
If that's the case, you've probably added a new dependency and isort configured itself and refuses to commit without its configuration file added again. If you do a git status
, you should see a new changed file named pyproject.toml
. So add it and commit again.
# what you did
git add foo/models.py
git commit
# fails
git add foo/models.py
git commit
# fails again
git add foo/models.py pyproject.toml
git commit
# runs successfully
Celery is added but not configured, so whenever you run python3 manage.py runserver
or pytest
you will see a warning to configure it. It is not configured in SOS Django Template because it highly depends on your project. You can see its settings line here and you can read this wonderful article to see how you can configure it.