jazzband / django-newsletter

An email newsletter application for the Django web application framework, including an extended admin interface, web (un)subscription, dynamic e-mail templates, an archive and HTML email support.
GNU Affero General Public License v3.0
850 stars 206 forks source link

Problems with cron configuration #329

Closed goromachine closed 4 years ago

goromachine commented 4 years ago

On the read the docs - installation - point 11, says to add a crontab to execute the django command. */15 * * * * <path_to_virtualenv>/bin/python <project_root>/manage.py submit_newsletter 1>/dev/null 2>&1

Well, I'm currently using crontab for my project but is to execute an script, so I really don't find the way of executing that python command through the cron. I know it should be simple, but I really don't find the correct route to execute it.

In my case, the scheme of the project is the following (and the venv is inside of it): .projectName

So having this which should be the right way of writing that command? I need the absolute path of both the venv and project paths?

I want to ask about the same path to execute on AWS EC2. I found this and it should work because is executed from the my_cron.config file and not directly from inside the settings.py, but I want to know in case anyone have the right answer already: '*/15 * * * *', 'source /opt/python/run/venv/bin/activate && cd /opt/python/current/app/ && python manage.py submit_newsletter > $HOME/cron-sqs.log 2>&1'

If you need any other information, please ask for it and I'll give it asap. Thank you.

dokterbob commented 4 years ago

Just use the Python from your venv, no need to activate it.