baranbartu / onthefly Goto Github PK
View Code? Open in Web Editor NEWChange Django Settings On the Fly
License: MIT License
Change Django Settings On the Fly
License: MIT License
This is not happening locally in dev, but is happening on production - both are using redis:alpine
docker. It appears to be occurring for any setting, and there are no stored settings yet. Two different places where it occurs.
File "/usr/local/lib/python3.6/site-packages/oscar/apps/dashboard/menu.py", line 14, in get_nodes
all_nodes = create_menu(settings.OSCAR_DASHBOARD_NAVIGATION)
File "/usr/local/src/django-onthefly/onthefly/monkey_patch.py", line 19, in __getattr__
return self.backend.get_value(name)
File "/usr/local/src/django-onthefly/onthefly/backend/__init__.py", line 58, in get_value
value = self.get(name)
File "/usr/local/src/django-onthefly/onthefly/backend/redis_backend.py", line 17, in get
return json.loads(dumped)
File "/usr/local/lib/python3.6/json/__init__.py", line 348, in loads
'not {!r}'.format(s.__class__.__name__))
TypeError: the JSON object must be str, bytes or bytearray, not 'NoneType'
[04:49:56][ERROR] django.request log.py:log_response:228 | Internal Server Error: /admin/onthefly-settings/
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/contrib/admin/sites.py", line 223, in inner
return view(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 158, in get
context = self.get_context_data(**kwargs)
File "/usr/local/src/django-onthefly/onthefly/admin.py", line 20, in get_context_data
'onthefly_settings': settings.get_onthefly_settings
File "/usr/local/src/django-onthefly/onthefly/monkey_patch.py", line 36, in get_onthefly_settings
return self.backend.values()
File "/usr/local/src/django-onthefly/onthefly/backend/redis_backend.py", line 37, in values
all_values[field] = json.loads(values[i])
File "/usr/local/lib/python3.6/json/__init__.py", line 348, in loads
'not {!r}'.format(s.__class__.__name__))
TypeError: the JSON object must be str, bytes or bytearray, not 'NoneType'
git grep --context 4 ONTHEFLY settings.py
REDIS_ENDPOINT = 'redis:6379'
if 'onthefly' in INSTALLED_APPS:
ONTHEFLY = {
'BACKEND': 'onthefly.backend.redis_backend.RedisBackend',
'OPTIONS': {'URL': f'redis://{REDIS_ENDPOINT}/15'},
}
Nice idea. The UI however is in need of some work.
So far I have found only one other app which comes close to this functionality, and it needed a bit of work in order to integrate with third-party apps. idlesign/django-siteprefs#25
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.