Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django sentry log only to sentry, not console
I have a django application with sentry integration. I have a management command that I know is gonna get quite a lot of exception, mostly due to network. I want to see the progress of the command in the console and I use tqdm for that and I dont want to see the errors in the console, but I do want to see the errors in sentry. I've set up my sentry in settings.py like so: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'sentry': { 'level': 'ERROR', 'class': 'sentry_sdk.integrations.logging.EventHandler', }, }, 'loggers': { 'devices.management.commands.send_to_device': { 'handlers': ['sentry'], 'level': 'ERROR', }, } } This is the command's code: failed = [] for obj in tqdm(lst): try: send(obj) except Exception as e: # log to sentry only (according to logging config in settings.py) logger.error(e, exc_info=True, extra={'obj': obj}) failed.append(obj) logging.getLogger('stats').warning(f'{len(failed)} failed') However, I do not get exceptions logged in sentry ... or even more weird, I a couple of them logged when I'm expecting hundreds. When I tried a simple logger.error('test') outside of the loop - it worked just fine. What am I missing? -
Elastic Beanstalk: Find package causing dependency installation error
Elastic Beanstalk returned the error Instance deployment failed to install application dependencies. after trying to deploy my Django application. I am guessing there is a package in the requirmenents.txt causing this. How do I find exactly which package is causing the installation error? -
Django DecimalField inconsistent rounding
Django 2.2, PostgreSQL database. I have a Line object with a positions property. This is an ArrayField of a DecimalField with a max_digits of 12 and decimal_places of 3. I want to store two floats as Decimals: pos = [6586.87849502, 2.04190477e-01, 7.14666669e-01] line = Line(positions=pos) line.save() line.refresh_from_db() # send it through Django's ORM piping print(line.positions) Output: [Decimal('6586.879'), Decimal('0.204'), Decimal('0.715')] Interestingly, the first position was rounded up despite its next more significant digit being below 5. The other float is rounded down as expected. The real issue is that I'm trying to predict what will come out of the database, down to the required precision of three decimal places: [Decimal(x).quantize(Decimal("0.001")) for x in pos] might yield [Decimal('6586.878'), Decimal('0.204'), Decimal('0.715')] or [Decimal('6586.879'), Decimal('0.205'), Decimal('0.714')] depending on the decimal.ROUND_* flag I pass in quantize(), but I never get consistent rounding throughout the array. How does Django round or is PostgreSQL doing something? -
Create/Update class-based view for Many-to-Many relationship with intermediate model
I'm trying to write Class-based view for class A and simultaneously provide adding values to M2M table between class A and class B. To be more precise, I will explain by following example. There is requirement to extend Many-To-Many relationship between Pizza and Toping with attribute of amount, so class Membership is also created like in code below. How to create class-base view for Pizza where user can create new Pizza and also select Toppings with amount? Also, there is one more requirement: Pizza must contain at least 3 type of Topping. First, I referenced to this solution, but this solution doesn't allow filling additional attribute(amount) of class Membership. from django.db import models class Pizza(models.Model): name = models.CharField(max_length=30) toppings = models.ManyToManyField('Topping', through='Membership') class Topping(models.Model): name = models.CharField(max_length=30) class Membership(models.Model): pizza= models.ForeignKey(Pizza, on_delete=models.CASCADE) topping = models.ForeignKey(Topping, on_delete=models.CASCADE) amount = models.IntegerField() -
Celery Beat acknowledging a task, running it but not executing it
The problem is I get the following log: celery_1 | [2021-03-15 19:00:00,124: INFO/MainProcess] Scheduler: Sending due task read_dof (api.tasks.read_dof) celery_1 | [2021-03-15 19:00:00,140: INFO/MainProcess] Scheduler: Sending due task read_bdm (api.tasks.read_bdm) celery_1 | [2021-03-15 19:00:00,141: INFO/MainProcess] Scheduler: Sending due task read_fixer (api.tasks.read_fixer) I have the following configuration for celery. Exchange is the name of my django project, which is where "celery.py" is and api is the name of my django app which is where my "tasks.py" is: from __future__ import absolute_import, unicode_literals import os from celery import Celery from celery.schedules import crontab os.environ.setdefault("DJANGO_SETTINGS_MODULE", "exchange.settings") app = Celery("exchange") app.config_from_object("django.conf:settings", namespace="CELERY") app.autodiscover_tasks() app.conf.beat_schedule = { 'read_bdm': { 'task': 'api.tasks.read_bdm', 'schedule': crontab(hour=19,minute=0), }, 'read_dof': { 'task': 'api.tasks.read_dof', 'schedule': crontab(hour=19,minute=0), }, 'read_fixer': { 'task': 'api.tasks.read_fixer', 'schedule': crontab(hour=19,minute=0), }, } Here is my tasks.py: from celery import shared_task from .models import BdmExch, DofExch, FixerExch from .helpers.bdmcrawler import parse_bdm from .helpers.dofcrawler import parse_dof from .helpers.fixercrawler import parse_fixer @shared_task(name='read_bdm') def read_bdm(): attempts=0 while attempts <3: try: result = parse_bdm() print(result) BdmExch.objects.create(time=result["date"],exch=result["exc"]) return except: attempts += 1 print("Parsing error on read_bdm") print("--------------- Parsing error on read_bdm -----------") return @shared_task(name='read_dof') def read_dof(): attempts=0 while attempts < 3: try: result = parse_dof() DofExch.objects.create(time=result["date"],exch=result["exc"]) return except: attempts += 1 print("Parsing error on … -
How to make textarea to return value?
I want to make a textarea for my website and this textarea going to return a processed value. For example, The user enters the sentence: "Anna has a great car!" the output should be represented sentence's statement. (Positive, negative or the keywords etc.) But for more information, I'm only working on this website's frontend part. So, how can I design this in HTML, CSS & JS? On the server-side, we are using Django, MongoDB and SQLite. -
Is it possible to run django migrations within a python script?
I have a django application, let's call it django_app and I can pip install django_app to get it installed. But I still need to run the migrations for this app. For one reason or another, the team's required to run the migrations within a python script. Is it possible to run the migrations within the another python script if the django application is installed via a pip command? -
How can i update django form's integerField max_value validator by giving input integer value?
I am developing a warehouse management and i want to warn if the admin gives number more than warehouse holds for a specific object. I am using crispy form by the way. -
Flask tensorflow parallel computing multiple requests
By basic calculation let's say if a python script takes 1 second to run for each user, if the script runs in a queue and the number of users is just 1000 it will take 1000 seconds(16.6 min) for the 1000th user to get their response. as my "python script" is taking almost that long, Is there any way to make it possible in Flask and/or Django for all users to get their responses in parallel? Image for better understanding the problem: Load balance in Django and/or flask thank you in advance. -
Django DFR TypeError: Direct assignment to the forward side of a many-to-many set is prohibited. Use answers.set() instead
I have problem with creating model by serializers. When i using this data: data = { 'name':'Quiz12', 'questions':[ {'question_text': 'Kim jestem?', 'answers': [ {'answer_text': 1, 'correct':False}, {'answer_text': 2, 'correct':False}, {'answer_text': 3, 'correct':True}, ], }, ], } I getting error. When I create only a question using QuestionSerializer everything works good. serializers.py class AnswerSerializer(serializers.ModelSerializer): class Meta: model = Answer fields = ['answer_text','correct'] class QuestionSerializer(serializers.ModelSerializer): answers = AnswerSerializer(many=True) class Meta: model = Question fields = ['question_text', 'answers'] def create(self, validated_data): answers_data = validated_data.pop('answers') question = Question.objects.create(**validated_data) for answer_data in answers_data: a1 = Answer.objects.create(question=question, **answer_data) question.answers.add(a1) return question class QuizSerializer(serializers.ModelSerializer): questions = QuestionSerializer(many=True) class Meta: model = Quiz fields = ['name', 'questions'] def create(self, validated_data): questions_data = validated_data.pop('questions') quiz = Quiz.objects.create(**validated_data) for question_data in questions_data: Question.objects.create(quiz=quiz, **question_data) return quiz models.py class Profile(models.Model): user = models.OneToOneField(User, null=True,on_delete=models.CASCADE) def __str__(self): return self.user.username class Quiz(models.Model): owner = models.OneToOneField(Profile,blank=True, null=True,on_delete=models.CASCADE) name = models.CharField(max_length=200, blank=True) date = models.DateTimeField(auto_now_add=True) questions = models.ManyToManyField("Question", related_name="Question1", blank=True, null=True) students = models.ManyToManyField("Profile", related_name="+", blank=True, null=True) def __str__(self): return str(self.name) class Question(models.Model): quiz = models.ForeignKey("Quiz", null=True, on_delete=models.CASCADE) question_text = models.CharField(max_length=500, default="Pytanie") answers = models.ManyToManyField("Answer", related_name="+", blank=True, null=True) def __str__(self): return str(self.question_text) class Answer(models.Model): answer_text = models.CharField(max_length=500, default="Odpowiedź") correct = models.BooleanField(default=False) question = models.ForeignKey("Question", null=True,on_delete=models.CASCADE) … -
how to solve error "'NoneType' object has no attribute 'day'" in django application
I noticed this error in my application, "'NoneType' object has no attribute 'day'". What I have noticed about it is that. I have a model named course_schedule, the course schedule has an option of Monday to Sunday. If the course schedule is partially populated, that is I populate only some days, like 3 days out of the complete 7 days in a week, I get the error but whenever I populate the course schedule populate course schedule model completely, I don't have the error and everything works well. error log: Traceback (most recent call last): File "C:\Users\Habib\Documents\django\FIVERR\Ayyub_SMS\venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner response = get_response(request) File "C:\Users\Habib\Documents\django\FIVERR\Ayyub_SMS\venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\Habib\Documents\django\FIVERR\Ayyub_SMS\sms\schoolapp\views.py", line 1754, in sir_course get_all = getall(2021, sch.day) Exception Type: AttributeError at /en/sir_course Exception Value: 'NoneType' object has no attribute 'day' models.py class Assign_teacher_to_courses(models.Model): Course_Name = models.ForeignKey(add_courses, on_delete=models.CASCADE) Teacher_Name = models.ForeignKey(add_teacher_by_manager, on_delete=models.CASCADE) def __str__(self): return self.Course_Name.Course_Name+" - "+self.Teacher_Name.teacher_ID+" - "+self.Teacher_Name.teacher_name class course_schedule(models.Model): days_choices = ( ("Mon", 'Monday'), ("Tue", 'Tuesday'), ('Wed', "Wednessday"), ('Thurs', "Thursday"), ('Fri', "Friday"), ('Sat', "Saturday"), ("Sun", "Sunday"), ) day = models.CharField(max_length=60, default="Sun") time_session = models.CharField(max_length=150, default='8:00am') end_session = models.CharField(max_length=150, default='10:00am') def __str__(self): return self.day views.py def sir_course(request): if request.method == "POST": … -
django.db.utils.OperationalError: no such column: app_commenti.sondaggio_id
i'm trying to do a school project, in this school project i would like to create an application using django, this application must allow to create pools, the users can vote and comment. i created the models, i made the migration and i did the migrate command. everething worked fine, but when i tried to add another foreignkey in 'Commenti' class django gave me problems. now the make migrations command work fine but when i try to do make migrate command the program goes into error.enter image description here -
Django-tables2 - can I pass a queryset filtered using values_list() and distinct() to my table?
I'm trying to pass a queryset to my table, but I want unique values for a set of fields. How can I use values_list().distinct() to obtain unique values for my fields, and pass this to the queryset of django-tables2? tables.py class JobTaxonLocationTable(tables.Table): result1 = tables.Column( accessor='JobResult.result1', verbose_name='Result1') result2 = tables.Column( accessor='JobResult.result2', verbose_name='Result2') class ViewJob(LoginRequiredMixin, SingleTableView): model = Model1 table_class = MyTable def get_table_data(self, **kwargs): """ ViewJob get_table_data request """ print('>get_table_data') # get job_obj from kwargs job_obj = Job.objects.get(pk=self.kwargs.get('pk')) if job_obj: self.object_list = self.object_list.filter(job_id=job_obj) # *at this point I want to restrain my object_list on unique values of result1, result2 - but self.object_list = self.object_list.values_list( "result_id__result1", "result_id__result2", ).distinct() return self.object_list else: return MyTable.objects.none() The self.object_list is now a values_list queryset so no data is now passed to django-tables2 table. Is there a way I can do this? -
Attribute Error: str object - has no attribute days. Attempting to migrate my model
Have two models that I am attempting to override the save functions (parent and Child). the models look like this: from django.db import models from django.urls import reverse from datetime import datetime, timedelta class Program(models.Model): air_date = models.DateField(default="0000-00-00") air_time = models.TimeField(default="00:00:00") service = models.CharField(max_length=10) block_time = models.TimeField(default="00:00:00") block_time_delta = models.DurationField(default="00:00:00") running_time = models.TimeField(default="00:00:00") running_time_delta = models.DurationField(default="00:00:00") remaining_time = models.TimeField(default="00:00:00") remaining_time_delta = models.DurationField(default="00:00:00") title = models.CharField(max_length=190) locked_flag = models.BooleanField(default=False) deleted_flag = models.BooleanField(default=False) library = models.CharField(null=True,max_length=190,blank=True) mc = models.CharField(null=True,max_length=64) producer = models.CharField(null=True,max_length=64) editor = models.CharField(null=True,max_length=64) remarks = models.TextField(null=True,blank=True) audit_time = models.DateTimeField(null=True) audit_user = models.CharField(null=True,max_length=32) def calculate_time(self): total_run_time_delta = timedelta(minutes=0) hold_remaining_delta = models.DurationField() for segs in self.segments.all(): total_run_time_delta += segs.length_time_delta self.running_time_delta = total_run_time_delta self.running_time = f"{self.running_time_delta}" self.remaining_time_delta = self.block_time_delta - total_run_time_delta self.remaining_time = f"{abs(self.remaining_time_delta)}" def save(self, *args, **kwargs): self.calculate_time() super().save(*args,**kwargs) def __str__(self): return f"{self.pk} : {self.title}" def get_absolute_url(self): return reverse('program_detail', args=[str(self.id)]) #return reverse('program-update', kwargs={'pk': self.pk}) class Segment(models.Model): program_id = models.ForeignKey(Program, on_delete=models.CASCADE, related_name='segments', #new link to Program ) sequence_number = models.DecimalField(decimal_places=2,max_digits=6,default="0.00") title = models.CharField(max_length=190) bridge_flag = models.BooleanField(default=False) length_time = models.TimeField(null=True,default=None, blank=True) author = models.CharField(max_length=64,null=True,default=None,blank=True) voice = models.CharField(max_length=64,null=True,default=None,blank=True) library = models.CharField(max_length=190,null=True,default=None,blank=True) summary = models.TextField() audit_time = models.DateTimeField(null=True) audit_user = models.CharField(null=True,max_length=32) def save( self, *args, **kwargs): program = Program.object.get(id=self.program_id) super().save(*args,**kwargs) program.save() def __str__(self): return self.author After … -
render() missing 1 required positional argument: 'data'
My Serialization Code enter image description here -
usercreationform can not change password label
I can't change password1,password2 labels from UserCreationForm class. The email address seems to be ok. What could be the problem? class SignUpForm(UserCreationForm): class Meta: model = User fields = ('email','password1','password2',) labels = { 'email' : 'Email address', 'password1' : 'Password', 'password2' : 'Confirmation Password', } -
why i get error when use get_object_or_404?
i used get_object_or_404 in api: @api_view(['POST']) def ticket(request): get_ticket = get_object_or_404(Ticket, pk=106) return Response({'result':'ok'}) when the ticket there is not..i get this error: django.contrib.sites.models.Site.DoesNotExist: Site matching query does not exist. -
Why am I able to GET data but not PUT it?
I am using React frontend and Django backend, deployed on Heroku. I require authentication (login done with Django), and authentication is required for the API. However, while axios is able to GET data, I am not able to PUT it without getting this error: Error: Request failed with status code 403 I have tried solutions here but none of have worked: CSRF with Django, React+Redux using Axios -
Django Rest Framework - Generate a Token for a non-built-in User model class
I wanted to know if I am able to create a Token for a normal model class. Suppose that I have the following class: class User(models.Model): name = models.CharField(max_length=30, unique=True) profile_pic = models.FileField(upload_to='None/',default='placeholder.jpg') joined_date = models.DateTimeField(verbose_name='date joined', auto_now_add=True) Note that my User class does not extend auth.models.User . Now when I use a signal like this: @receiver(post_save, sender=User) def create_auth_token(sender, instance=None, created=False, **kwargs): if created: Token.objects.create(user=instance) Then Django states that Token.user is not an instance of User. Basically, the same as in this SO thread. From that link above, I learned that my User class has to extend the built-in auth.models.User class provided by Django for authentication. But I am curious and would like to know if there is a way to generate a Token for classes that do not extend auth.models.User ? Is that possible ? If yes, how ? -
Django form.is_valid() is skipped and return false
My form doesn't read the is_valid() part. In the terminal it returns: "POST /app/contact/send_/ HTTP/1.1" 302 0 "GET /app/contact/send_/fail/ HTTP/1.1" 200 4648 I tried to typed random words inside the form.is_valid(), still returns the same as above. It won't allow to successfully send the information to destined email address. I don't know what I have missed. Any help is great. Thank you My Models.py class MessageForm(models.Model): CATEGORY = ( ('B', 'Business inquiry',), ('C', 'Career opportunity',), ('G', 'General inquiry',), ) name = models.CharField(max_length=200) email = models.EmailField(max_length=200) phone = models.CharField(max_length=200) category = models.CharField(max_length=1, choices=CATEGORY) text = models.TextField() forms.py from django import forms from .models import MessageForm class MessagesForm(forms.ModelForm): class Meta: model = MessageForm fields = ['name','email','phone','category','text'] labels = { 'name': "Name", 'email': "Email ", 'phone': "Phone", 'category': "Category", 'text': "How can we help you with?" } Views.py from .forms import MessagesForm from django.shortcuts import render, redirect from django.core.mail import send_mail def contact(request): if request.method == 'POST': form = MessagesForm(request.POST) if form.is_valid(): name = form.cleaned_data['name'] email = form.cleaned_data['email'] phone = form.cleaned_data['phone'] category = form.cleaned_data['category'] text = form.cleaned_data['text'] subject = [name, phone, category] form.save() send_mail(subject, text, email, [settings.EMAIL_HOST_USER], fail_silently=False) return redirect('success/', status='success') else: return redirect('fail/', status='fail') else: form = MessagesForm() context ={'form':form} return render(request, … -
Django 'Handler' is not defined
I'm currently working on a Django REST project, and trying to implement the Chain of responsibility pattern on it. Since I downgraded my Python version from 3.9.2 to 3.6.5, I've encountered another problem, which is the following: NameError: name 'Handler' is not defined And this is the code where the error is: from abc import ABCMeta, abstractmethod from typing import Any, Optional class Handler(metaclass=ABCMeta): """ The Handler interface declares a method for building the chain of handlers. It also declares a method for executing a request. """ @abstractmethod def set_next(self, handler: Handler) -> Handler: pass @abstractmethod def handle(self, request) -> Optional[str]: pass How can I fix it? -
Why does my HTML footer's width doesn't fill the whole page?
I'm currently using Django to make a website, with Programming With Mosh's tutorial as my foundation. I'm trying to add a footer into my page, but it doesn't fill the whole width of the page. Here's the picture of the footer: https://i.stack.imgur.com/PSgBp.png Here's my base code (Footer part only, to save some time): <body> <div class='container'> {% block content %} {% endblock %} </div> <!--Footer--> <style> .footer-dark { margin:0; padding:50px 0; color:#f0f9ff; background-color:#282d32; } .footer-dark h3 { margin-top:0; margin-bottom:12px; font-weight:bold; font-size:16px; } .footer-dark ul { padding:0; list-style:none; line-height:1.6; font-size:14px; margin-bottom:0; } .footer-dark ul a { color:inherit; text-decoration:none; opacity:0.6; } .footer-dark ul a:hover { opacity:0.8; } @media (max-width:767px) { .footer-dark .item:not(.social) { text-align:center; padding-bottom:20px; } } .footer-dark .item.text { margin-bottom:36px; } @media (max-width:767px) { .footer-dark .item.text { margin-bottom:0; } } .footer-dark .item.text p { opacity:0.6; margin-bottom:0; } .footer-dark .item.social { text-align:center; } @media (max-width:991px) { .footer-dark .item.social { text-align:center; margin-top:20px; } } .footer-dark .item.social > a { font-size:20px; width:36px; height:36px; line-height:36px; display:inline-block; text-align:center; border-radius:50%; box-shadow:0 0 0 1px rgba(255,255,255,0.4); margin:0 8px; color:#fff; opacity:0.75; } .footer-dark .item.social > a:hover { opacity:0.9; } .footer-dark .copyright { text-align:center; padding-top:24px; opacity:0.3; font-size:13px; margin-bottom:0; } </style> <div class="footer-dark"> <footer> <div class="container"> <div class="row"> <div class="col-sm-6 col-md-3 … -
django.db.utils.OperationalError: no such table: contacts_contact
I am trying to migrate to migrate my database using python manage.py makemigrations but always getting this error django.db.utils.OperationalError: no such table: here is the full traceback. python manage.py makemigrations Traceback (most recent call last): File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute return Database.Cursor.execute(self, query, params) sqlite3.OperationalError: no such table: contacts_contact The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/management/base.py", line 366, in execute self.check() File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/management/base.py", line 392, in check all_issues = self._run_checks( File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/management/base.py", line 382, in _run_checks return checks.run_checks(**kwargs) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/urls/resolvers.py", line 407, in check for pattern in self.url_patterns: File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/urls/resolvers.py", line 588, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/neonwave/.virtualenvs/42/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__ res = … -
Find all records without a field
I have mongoDB with an object totals in collection. In some objects dissapeared fields value I have a function which can add field value to objects So how can I make a query which returns all records where it's not value pd = PaymentDoc.objects( date__gte=datetime(2021, 1, 1, 0, 0), #totals__value what should be here? ) -
Django-crontab using AWS EBS
I have successfully created a cron job using the Django-crontab library and its running as expected locally. I now need to deploy my app to Elastic beanstalk but I am not sure how to add my cron jobs once my app is deployed. When running my app locally python manage.py crontab add is used to initialize my jobs. How do I do this using Elastic Beanstalk? settings.py CRONJOBS = [ ('0 9 * * *', 'verify.cron.remove_empty_pages'), ('0 9 * * *', 'verify.cron.remove_expired_credits'), ('*/59 * * * *', 'verify.cron.disconnect_accounts') ]