Fixes on webapps

This commit is contained in:
Marc Aymerich 2015-04-30 11:24:18 +00:00
parent 83831edf0b
commit 94941a633f
7 changed files with 37 additions and 5 deletions

29
TODO.md
View file

@ -298,3 +298,32 @@ https://code.djangoproject.com/ticket/24576
# django SITE_NAME vs ORCHESTRA_SITE_NAME ?
# accounts.migrations link to last auth migration instead of first
Replace celery by a custom solution?
* No more jumbo dependencies and wierd bugs
1) Periodic Monitoring:
* runtask management command + crontab scheduling or high performance beat crontab (not loading bloated django system)
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('method', help='')
parser.add_argument('args', nargs='*', help='')
def handle(self, *args, **options):
method = import_class(options['method'])
kwargs = {}
arguments = []
for arg in args:
if '=' in args:
name, value = arg.split('=')
kwargs[name] = value
else:
arguments.append(arg)
args = arguments
method(*args, **kwargs)
2) Single time shot:
sys.run("python3 manage.py runtas 'task' args")
3) Emails:
Custom backend that distinguishes between priority and bulk mail
priority: custom Thread backend
bulk: wrapper arround django-mailer to avoid loading django system

View file

@ -6,7 +6,7 @@ from .serializers import SetPasswordSerializer
class SetPasswordApiMixin(object):
@detail_route(serializer_class=SetPasswordSerializer)
@detail_route(methods=['post'], serializer_class=SetPasswordSerializer)
def set_password(self, request, pk):
obj = self.get_object()
data = request.DATA

View file

@ -89,7 +89,6 @@ INSTALLED_APPS = (
'orchestra.contrib.miscellaneous',
'orchestra.contrib.bills',
'orchestra.contrib.payments',
'orchestra.contrib.tasks',
# Third-party apps
'django_extensions',

View file

@ -135,6 +135,7 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
def get_options(self, webapp):
kwargs = {}
print(webapp.data)
if self.MERGE:
kwargs = {
'webapp__account': webapp.account,

View file

@ -54,6 +54,7 @@ class WebApp(models.Model):
def clean(self):
apptype = self.type_instance
apptype.validate()
a = apptype.clean_data()
self.data = apptype.clean_data()
@cached

View file

@ -92,10 +92,10 @@ class CMSApp(PHPApp):
user.set_password(password)
user.save()
db.users.add(user)
self.instance.data = {
self.instance.data.update({
'db_name': db_name,
'db_user': db_user,
'password': password,
'db_id': db.id,
'db_user_id': user.id,
}
})

View file

@ -47,9 +47,11 @@ def database_ready():
return (not running_syncdb() and
'setuppostgres' not in sys.argv and
'test' not in sys.argv and
# Celerybeat has yet to stablish a connection at AppConf.ready()
'celerybeat' not in sys.argv and
# Allow to run python manage.py without a database
len(sys.argv) <= 1 and
'--help' in sys.argv)
'--help' not in sys.argv)
def dict_setting_to_choices(choices):