new_url command will automatically gather and replace the router file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s

This commit is contained in:
pierre geeraert
2026-07-03 23:43:37 +01:00
parent d7ef0fcd3e
commit 2ba56cb00f
4 changed files with 117 additions and 97 deletions
@@ -4,21 +4,44 @@ import os
#import jinja2
from jinja2 import Environment, FileSystemLoader
router_path = os.path.join(settings.BASE_DIR,'core','routers_jinja.py')
router_path = os.path.join(settings.BASE_DIR,'core','routers.py')
class Command(BaseCommand):
args = '<team_id>'
help = 'Affiche la liste des backlogs'
template_dir = os.path.join(settings.BASE_DIR, 'templates')
env = Environment(loader=FileSystemLoader(template_dir))
template = env.get_template('helloWorld.jinja')
output = template.render(name = 'Geeks')
def extract_settings_database(self):
settings_databases = []
for database in settings.DATABASES:
if database == 'default':
continue
print(database)
with open(router_path, 'w') as f:
print(output, file = f)
database_label = database.split('_db')[0]
settings_databases.append([database,database_label])
return settings_databases
def coucou(self):
self.stdout.write('Coucou !')
def templating(self,databases_list):
template_dir = os.path.join(settings.BASE_DIR, 'templates','routers')
env = Environment(loader=FileSystemLoader(template_dir))
template = env.get_template('routers.jinja.py')
output = template.render(databases_list = databases_list)
print(output)
with open(router_path, 'w') as f:
print(output, file = f)
print(output)
def main(self):
databases_list = self.extract_settings_database()
print(databases_list)
self.templating(databases_list)
self.coucou()
def handle(self, *args, **options):
self.stdout.write('Coucou !')
self.main()