Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8376639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:28:32+00:00 2026-06-09T15:28:32+00:00

I am working on a Django web based project in which i need to

  • 0

I am working on a Django web based project in which i need to build a application which work in the following sequence:

1) user open a page in which he need to enter a command and a time

2) Django application will execute that command at a given time on each day till user off the scheduler (by default it is True)

What i am facing the problem is that :

1) How should i execute the commands on a time but on each day. To save the commands and time i created a following model in my models.py

class commands(models.Model):
    username = models.ForeignKey(User)
    command = models.CharField(max_length=30)
    execution_time = models.DateField()

I have the same time but i am not getting the right way to execute it on each day at the given time

and is it possible to do with pytz library?

For executing the commands i am using paramiko library

PS: I don’t want to use any external library

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:28:33+00:00Added an answer on June 9, 2026 at 3:28 pm

    While you could have your django app add and remove cron jobs on the system, another more django-ish approach would be to use Celery. It is a task queue system that can run both synch and async tasks.

    One specific feature of Celery is scheduled tasks: http://packages.python.org/celery/userguide/periodic-tasks.html

    from datetime import timedelta
    
    CELERYBEAT_SCHEDULE = {
        "runs-every-30-seconds": {
            "task": "tasks.add",
            "schedule": timedelta(seconds=30),
            "args": (16, 16)
        },
    }
    

    They also have a more granular version of the period task that replicates the scheduling of a crontab:

    from celery.schedules import crontab
    
    CELERYBEAT_SCHEDULE = {
        # Executes every Monday morning at 7:30 A.M
        'every-monday-morning': {
            'task': 'tasks.add',
            'schedule': crontab(hour=7, minute=30, day_of_week=1),
            'args': (16, 16),
        },
    }
    

    Celery by itself is stand-alone but there is the django-celery specific verison

    The benefit of this solution is that you do not need to edit and maintain a system-level cron tab. This is a solution that is highly integrated into django for this exact use.

    Also a huge win over using a cron is that Celery can scale with your system. If you were using a basic system crontab, then the tasks would be located on the server that hosts the application. But what if you needed to ramp up your site and run it on 5 web application nodes? You would need to centralize that crontab. If you are using Celery, you have a large number of options for how to transport and store tasks. It is inherently distributed, and available in sync to all your application servers. It is portable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a user based, social networking type of web application in Django.
The Django-based web application I'm working on is translated to a few different languages.
I'm working on a Django web application which (amongst other things) needs to handle
I am working on a Python/django web application and I need to extract text
I am working on a Django application which allows a user to upload files.
I'm working on a Web service in Django, and I need to model a
I am working on building a web-application using Django. Since I'm new to working
I'm working on my first web app (www.shopperspoll.com). It's a Django based facebook app
Background: I'm working a project which uses Django with a Postgres database. We're also
I'm building a web-based productivity application that has to deal with modest user concurrency,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.