-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Much better Django integration #906
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
PR type: breaking 💥
Contains breaking changes
PR type: feature ⭐️
Contains new features
labels
Jan 21, 2024
@turicas you will probably be interested by this PR. If you want more info, feel free to ask here or on the shiny new discord server (link at the top of the project README) I'll need to fix the test, but otherwise, it's starting to look great. |
ewjoachim
force-pushed
the
django
branch
2 times, most recently
from
January 23, 2024 23:37
1fd637e
to
bef22ca
Compare
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #363
Successful PR Checklist:
Tasks from #363
pip install procrastinate[django]
Add
"procrastinate.contrib.django"
toINSTALLED_APPS
Tweak one or two
PROCRASTINATE_*
variables inside Django'ssettings.py
fileCreate tasks inside
myapp/tasks.py
, decorating them withprocrastinate.task
from procrastinate.contrib.django import app
,@app.task
Run the worker with
python manage.py procrastinate-worker
(setDJANGO_SETTINGS_MODULE
env var when running the worker)python manage.py procrastinate worker
instead. Note that manage.py alreadysets
DJANGO_SETTINGS_MODULE
.Monitor tasks inside Django Admin (running, finished, failed, waiting etc.)
Fix existing tests
Write new tests (especially, Django tests, and "Django ORM in tasks" tests including async ORM)
Breaking change announcement draft
This release refactors the Django integration completely. Head to the Django section in the doc to discover how it works.
Here's a summary of the changes:
INSTALLED_APPS
, you can useprocrastinate.contrib.django.app
. The app will be opened for you at the start of the process (during Django's setup) and will be properly closed when the process stops.tasks
submodule of any app inINSTALLED_APPS
are loaded by default. This is configurable.PROCRASTINATE_*
in your Django settings. They include specifying where your tasks are (among other things)./manage.py procrastinate
(if you use that, you won't have to configure anApp
either)ModelAdmins
in your Django Admin. Those models are read-only. The Admin panels are very very basic for now.PR label(s):