mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-07-22 11:55:02 +00:00
move scripts to dedicated module (#13)
This commit is contained in:
parent
5c8157057a
commit
cb10d0ca1e
6 changed files with 1 additions and 1 deletions
31
python/djls/scripts/django_setup.py
Normal file
31
python/djls/scripts/django_setup.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from django.conf import settings
|
||||
from django.template.engine import Engine
|
||||
|
||||
|
||||
def get_django_setup_info():
|
||||
return {
|
||||
"installed_apps": list(settings.INSTALLED_APPS),
|
||||
"templatetags": [
|
||||
{
|
||||
"name": tag_name,
|
||||
"library": module_name.split(".")[-1],
|
||||
"doc": tag_func.__doc__ if hasattr(tag_func, "__doc__") else None,
|
||||
}
|
||||
for module_name, library in (
|
||||
[("", lib) for lib in Engine.get_default().template_builtins]
|
||||
+ sorted(Engine.get_default().template_libraries.items())
|
||||
)
|
||||
for tag_name, tag_func in library.tags.items()
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import django
|
||||
|
||||
django.setup()
|
||||
print(json.dumps(get_django_setup_info()))
|
Loading…
Add table
Add a link
Reference in a new issue