Skip to content

Latest commit

 

History

History
122 lines (80 loc) · 3.79 KB

File metadata and controls

122 lines (80 loc) · 3.79 KB
layout default
title 🚀 django-crontask - Schedule Django Tasks Easily
description 🌟 Schedule recurring asynchronous tasks in Django effortlessly with cron-style syntax and lightweight helpers built on APScheduler.

🚀 django-crontask - Schedule Django Tasks Easily

Download django-crontask

📦 Overview

django-crontask is a cron-style scheduler for Django's task framework. It allows you to automate routine tasks in your Django projects. Whether it's sending emails, cleaning up databases, or running data backups, django-crontask makes it simple to set up and manage scheduled tasks.

📝 Features

  • Simple Scheduling: Set tasks to run at specified times using easy-to-understand syntax.
  • Django Integration: Works seamlessly with Django's existing task framework.
  • Flexible Options: Customize scheduling to fit your project needs.
  • User-Friendly: Designed for users with no programming experience.

🌟 Topics

  • cron
  • cronjob
  • crontab
  • django
  • tasks

🚀 Getting Started

1. Requirements

Before you begin, ensure you have the following:

  • A machine running Windows, macOS, or Linux.
  • Python installed (version 3.6 or above).
  • A Django project set up.

2. Download & Install

Visit this page to download: Releases Page.

Click on the latest version to download the installer.

3. Installing django-crontask

Once you've downloaded the installer, follow these steps:

  1. Locate the downloaded file in your downloads folder.
  2. Double-click the file to run the installer.
  3. Follow the on-screen instructions to complete the installation.

4. Configuring django-crontask

After installation, you need to configure django-crontask in your Django settings:

  1. Open your Django project directory.
  2. Go to the settings.py file.
  3. Add django_crontask to your INSTALLED_APPS list.
INSTALLED_APPS = [
    ...  # Your existing apps
    'django_crontask',
]
  1. Save the changes.

5. Creating Your First Task

To create a scheduled task, follow these steps:

  1. Navigate to your Django project directory.
  2. Create a new Python file (e.g., tasks.py).
  3. Define your task function:
from crontask import Crontask

@Crontask('*/15 * * * *')  # Runs every 15 minutes
def my_scheduled_task():
    # Your task code here
    print("Task is running!")
  1. Save the file.

6. Running the Scheduler

To run the scheduler, use the following command in your terminal:

python manage.py crontask

This command starts the scheduler, and your tasks will run according to the configured timings.

🌐 Additional Resources

  • Documentation: Explore detailed documentation for advanced features and options.
  • Support: Join the community forums for help and support.

🛠️ Troubleshooting Common Issues

  • Task Not Running: Check your cron syntax. Ensure it follows the correct format.
  • Django Errors: Review the task function for any coding mistakes.
  • Permissions Issues: Make sure that your user has the necessary permissions to run cron tasks.

📞 Getting Help

If you encounter any issues, you can reach out for help on the GitHub issues page. Describe your problem clearly, and the community will assist you.

🔗 Useful Links

🥳 Conclusion

With django-crontask, managing scheduled tasks in your Django applications is straightforward. Follow the steps above to get started quickly. Enjoy automating your tasks!