Fixes on webapps
This commit is contained in:
parent
83831edf0b
commit
94941a633f
29
TODO.md
29
TODO.md
|
@ -298,3 +298,32 @@ https://code.djangoproject.com/ticket/24576
|
||||||
# django SITE_NAME vs ORCHESTRA_SITE_NAME ?
|
# django SITE_NAME vs ORCHESTRA_SITE_NAME ?
|
||||||
|
|
||||||
# accounts.migrations link to last auth migration instead of first
|
# 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
|
||||||
|
|
|
@ -6,7 +6,7 @@ from .serializers import SetPasswordSerializer
|
||||||
|
|
||||||
|
|
||||||
class SetPasswordApiMixin(object):
|
class SetPasswordApiMixin(object):
|
||||||
@detail_route(serializer_class=SetPasswordSerializer)
|
@detail_route(methods=['post'], serializer_class=SetPasswordSerializer)
|
||||||
def set_password(self, request, pk):
|
def set_password(self, request, pk):
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
data = request.DATA
|
data = request.DATA
|
||||||
|
|
|
@ -89,7 +89,6 @@ INSTALLED_APPS = (
|
||||||
'orchestra.contrib.miscellaneous',
|
'orchestra.contrib.miscellaneous',
|
||||||
'orchestra.contrib.bills',
|
'orchestra.contrib.bills',
|
||||||
'orchestra.contrib.payments',
|
'orchestra.contrib.payments',
|
||||||
'orchestra.contrib.tasks',
|
|
||||||
|
|
||||||
# Third-party apps
|
# Third-party apps
|
||||||
'django_extensions',
|
'django_extensions',
|
||||||
|
|
|
@ -135,6 +135,7 @@ class PHPBackend(WebAppServiceMixin, ServiceController):
|
||||||
|
|
||||||
def get_options(self, webapp):
|
def get_options(self, webapp):
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
print(webapp.data)
|
||||||
if self.MERGE:
|
if self.MERGE:
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'webapp__account': webapp.account,
|
'webapp__account': webapp.account,
|
||||||
|
|
|
@ -54,6 +54,7 @@ class WebApp(models.Model):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
apptype = self.type_instance
|
apptype = self.type_instance
|
||||||
apptype.validate()
|
apptype.validate()
|
||||||
|
a = apptype.clean_data()
|
||||||
self.data = apptype.clean_data()
|
self.data = apptype.clean_data()
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
|
|
|
@ -92,10 +92,10 @@ class CMSApp(PHPApp):
|
||||||
user.set_password(password)
|
user.set_password(password)
|
||||||
user.save()
|
user.save()
|
||||||
db.users.add(user)
|
db.users.add(user)
|
||||||
self.instance.data = {
|
self.instance.data.update({
|
||||||
'db_name': db_name,
|
'db_name': db_name,
|
||||||
'db_user': db_user,
|
'db_user': db_user,
|
||||||
'password': password,
|
'password': password,
|
||||||
'db_id': db.id,
|
'db_id': db.id,
|
||||||
'db_user_id': user.id,
|
'db_user_id': user.id,
|
||||||
}
|
})
|
||||||
|
|
|
@ -47,9 +47,11 @@ def database_ready():
|
||||||
return (not running_syncdb() and
|
return (not running_syncdb() and
|
||||||
'setuppostgres' not in sys.argv and
|
'setuppostgres' not in sys.argv and
|
||||||
'test' 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
|
'celerybeat' not in sys.argv and
|
||||||
|
# Allow to run python manage.py without a database
|
||||||
len(sys.argv) <= 1 and
|
len(sys.argv) <= 1 and
|
||||||
'--help' in sys.argv)
|
'--help' not in sys.argv)
|
||||||
|
|
||||||
|
|
||||||
def dict_setting_to_choices(choices):
|
def dict_setting_to_choices(choices):
|
||||||
|
|
Loading…
Reference in New Issue