new_url command will automatically gather and replace the router file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user