Commit efc45ca7 by 周田

mod: 脚本生成模块

parent e2bb4421
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class ScriptsGenerateConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'scripts_generate'
from jinja2 import Environment, FileSystemLoader
import subprocess
# jinja2-3.1.2
env = Environment(loader=FileSystemLoader('./script_templates'))
template = env.get_template('template.jinja')
data = {
'msg': 'hello world!'
}
with open('script.py', 'w', encoding='utf-8') as f:
f.write(template.render(data))
from django.db import models
# Create your models here.
print('{{msg}}')
\ No newline at end of file
print('hello world!')
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment