django-q
django-q copied to clipboard
Problem with migrations
Basically when you write your Schedule in models.py, you won't be able to migrate or makemigrations when you run a fresh app from github, any idea how to solve that?
What do you mean by "you won't be able to migrate or makemigrations"? What happens when you try?
I had same issue when I try run schedule function in ready() To resolve this issue i must do something like this
import sys
from django.apps import AppConfig
class DjangoNewsletterConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'django_newsletter'
def ready(self):
if 'migrate' in sys.argv or 'makemigrations' in sys.argv or 'collectstatic' in sys.argv:
return
# This is schedule function
from .schedule import schedule_delete_not_confirmed_members
schedule_delete_not_confirmed_members()