예제 #1
0
파일: views.py 프로젝트: imfht/flaskapps
 def check_templates():
     from ..page.models import Template
     from ..auth.models import User
     from flask import current_app
     templates = Template.query.all()
     template_dir = current_app.config['ROOT_PATH'] + '/' + 'templates'
     if not os.path.exists(template_dir):
         os.mkdir(template_dir)
     names = [t.name for t in templates]
     for t in os.listdir(template_dir):
         if not t in names:
             temp = Template()
             temp.name = t
             temp.filename = os.path.join(template_dir,t)
             temp.body = open(os.path.join(template_dir,t),'r').read()
             temp.save()
예제 #2
0
 def check_templates():
     from page.models import Template
     from auth.models import User
     from app import app
     from blog.models import Article
     from .utils import fix_unicode
     templates = Template.query.all()
     template_dir = app.config['ROOT_PATH'] + '/' + 'templates'
     if not os.path.exists(template_dir):
         os.mkdir(template_dir)
     names = [t.name for t in templates]
     for t in os.listdir(template_dir):
         if not t in names:
             temp = Template()
             temp.name = t
             temp.location = os.path.join(template_dir,t)
             temp.save()
예제 #3
0
파일: views.py 프로젝트: shydesky/flask-cms
 def check_templates():
     from page.models import Template
     from auth.models import User
     from app import app
     from blog.models import Article
     from .utils import fix_unicode
     templates = Template.query.all()
     template_dir = app.config['ROOT_PATH'] + '/' + 'templates'
     if not os.path.exists(template_dir):
         os.mkdir(template_dir)
     names = [t.name for t in templates]
     for t in os.listdir(template_dir):
         if not t in names:
             temp = Template()
             temp.name = t
             temp.location = os.path.join(template_dir, t)
             temp.save()