Example #1
0
 def create(cls, basedir, resource_dir=None, source_dir=None,
            template=None, priority=DEFAULT_FILE_STORAGE_PRIORITY):
     resource_dir = resource_dir or os.path.join(basedir, '_resources')
     source_dir = source_dir or os.path.join(basedir, '_sources')
     if template is not None:
         if not os.path.exists(template):
             raise FileNotFoundError("Couldn't find template file '{}'"
                                     .format(template))
     else:
         template = os.path.join(basedir, 'template.html')
         if not os.path.exists(template):
             template = None
     return cls(basedir, resource_dir, source_dir, template, priority)
Example #2
0
 def create(cls,
            basedir,
            resource_dir=None,
            source_dir=None,
            template=None):
     if not os.path.exists(basedir):
         os.makedirs(basedir)
     resource_dir = resource_dir or os.path.join(basedir, '_resources')
     source_dir = source_dir or os.path.join(basedir, '_sources')
     if template is not None:
         if not os.path.exists(template):
             raise FileNotFoundError(
                 "Couldn't find template file '{}'".format(template))
     else:
         template = os.path.join(basedir, 'template.html')
         if not os.path.exists(template):
             template = None
     return cls(basedir, resource_dir, source_dir, template)