Added tasks app

This commit is contained in:
Marc Aymerich 2015-05-03 20:08:32 +00:00
parent 83208fa093
commit eabe587408
5 changed files with 26 additions and 22 deletions

View File

@ -34,11 +34,20 @@ Fast Deployment Setup
To only run the Python interface follow these steps: To only run the Python interface follow these steps:
```bash ```bash
python3 -menv env-django-orchestra # Create a new virtualenv
python3 -mvenv env-django-orchestra
source env-django-orchestra/bin/activate source env-django-orchestra/bin/activate
echo $HOME/django-orchestra/ | sudo tee env-django-orchestra/lib/python3*/site-packages/orchestra.pth pip3 install django-orchestra==dev \
pip3 install -r $HOME/django-orchestra/requirements.txt --allow-external django-orchestra \
django-admin.py startproject panel --template="$HOME/django-orchestra/orchestra/conf/project_template" --allow-unverified django-orchestra
# Install dependencies
sudo apt-get install python3.4-dev libxml2-dev libxslt1-dev libcrack2-dev
pip3 install -r \
https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt
# Create an orchestra instance
orchestra-admin startproject panel
python3 panel/manage.py migrate accounts python3 panel/manage.py migrate accounts
python3 panel/manage.py migrate python3 panel/manage.py migrate
python3 panel/manage.py runserver python3 panel/manage.py runserver

11
TODO.md
View File

@ -311,14 +311,16 @@ Replace celery by a custom solution?
*priority: custom Thread backend *priority: custom Thread backend
*bulk: wrapper arround django-mailer to avoid loading django system *bulk: wrapper arround django-mailer to avoid loading django system
# Create a new virtualenv
python3 -mvenv env-django-orchestra python3 -mvenv env-django-orchestra
source env-django-orchestra/bin/activate source env-django-orchestra/bin/activate
pip3 install django-orchestra==dev --allow-external django-orchestra --allow-unverified django-orchestra pip3 install django-orchestra==dev --allow-external django-orchestra --allow-unverified django-orchestra
# Install dependencies
sudo apt-get install python3.4-dev libxml2-dev libxslt1-dev libcrack2-dev
pip3 install -r https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt pip3 install -r https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt
# TODO make them optional # Create an orchestra instance
sudo apt-get install python3.4-dev libxml2-dev libxslt1-dev libcrack2-dev
wget -O - https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt | xargs pip3 install
orchestra-admin startproject panel orchestra-admin startproject panel
python3 panel/manage.py migrate accounts python3 panel/manage.py migrate accounts
python3 panel/manage.py migrate python3 panel/manage.py migrate
@ -352,9 +354,10 @@ Collecting lxml==3.3.5 (from -r re (line 22))
# deprecate install_dependnecies in favour of only requirements.txt # deprecate install_dependnecies in favour of only requirements.txt
# import module and sed # import module and sed
# if setting.value == default. remove # if setting.value == default. remove
# cron backend: os.cron or uwsgi.cron # TASKS_ENABLE_UWSGI_CRON
# reload generic admin view ?redirect=http... # reload generic admin view ?redirect=http...
# inspecting django db connection for asserting db readines? # inspecting django db connection for asserting db readines?
# wake up django mailer on send_mail # wake up django mailer on send_mail
# project settings modified copy of django's default project settings # project settings modified copy of django's default project settings

View File

@ -131,8 +131,6 @@ function install_requirements () {
python3-pip \ python3-pip \
python3-psycopg2 \ python3-psycopg2 \
python3-lxml \ python3-lxml \
postgresql \
rabbitmq-server \
python3-dev \ python3-dev \
bind9utils \ bind9utils \
python3-cracklib \ python3-cracklib \
@ -143,7 +141,7 @@ function install_requirements () {
gettext" gettext"
# TODO remove celery deps, django 1.8.1, glic3rinu fork, celery email # TODO remove celery deps, django 1.8.1, glic3rinu fork, celery email
PIP="django==1.8 \ PIP="django==1.8.1 \
django-celery-email==1.0.4 \ django-celery-email==1.0.4 \
https://github.com/glic3rinu/django-fluent-dashboard/archive/master.zip \ https://github.com/glic3rinu/django-fluent-dashboard/archive/master.zip \
https://bitbucket.org/izi/django-admin-tools/get/a0abfffd76a0.zip \ https://bitbucket.org/izi/django-admin-tools/get/a0abfffd76a0.zip \
@ -208,20 +206,12 @@ function install_requirements () {
run pip3 install $PIP run pip3 install $PIP
# TODO remove
# Some versions of rabbitmq-server will not start automatically by default unless ...
sed -i "s/# Default-Start:.*/# Default-Start: 2 3 4 5/" /etc/init.d/rabbitmq-server
sed -i "s/# Default-Stop:.*/# Default-Stop: 0 1 6/" /etc/init.d/rabbitmq-server
run update-rc.d rabbitmq-server defaults
# Patch passlib # Patch passlib
# TODO discover locaion by importing it
IMPORT="from django.contrib.auth.hashers import mask_hash, _" IMPORT="from django.contrib.auth.hashers import mask_hash, _"
COLLECTIONS="from collections import OrderedDict" COLLECTIONS="from collections import OrderedDict"
ls /usr/local/lib/python*/dist-packages/passlib/ext/django/utils.py \ PASSLIB_PATH=$(python3 -c "from passlib.ext.django import utils; print(utils.__file__)")
| xargs sed -i "s/${IMPORT}, SortedDict/${IMPORT}\n ${COLLECTIONS}/" sed -i "s/${IMPORT}, SortedDict/${IMPORT}\n ${COLLECTIONS}/" $PASSLIB_PATH
ls /usr/local/lib/python*/dist-packages/passlib/ext/django/utils.py \ sed -i "s/SortedDict/OrderedDict/g" $PASSLIB_PATH
| xargs sed -i "s/SortedDict/OrderedDict/g"
} }
export -f install_requirements export -f install_requirements

View File

@ -273,3 +273,4 @@ FLUENT_DASHBOARD_APP_ICONS = {
# Django-celery # Django-celery
import djcelery import djcelery
djcelery.setup_loader() djcelery.setup_loader()
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'

View File

@ -78,6 +78,7 @@ def apply_async_override(fn, name):
def task(fn=None, **kwargs): def task(fn=None, **kwargs):
# TODO override this if 'celerybeat' in sys.argv ?
from . import settings from . import settings
# register task # register task
if fn is None: if fn is None: