from django.apps import AppConfig
class FacesetConfig(AppConfig):
name = 'faceset'
verbose_name = "Что-то твое на русском на родном"
class Timetables(models.Model):
name = models.CharField(u'time', max_length=30)
class Meta:
verbose_name = 'Что-то твое на русском на родном'
verbose_name_plural = 'Что-то твое на русском на родном'
def __str__(self):
return self.name
import os
import io
import zipfile
def zip_directory_into_bytes(path):
bio = io.BytesIO()
with zipfile.ZipFile(bio, mode='w', compression=zipfile.ZIP_DEFLATED) as zf:
abs_path = os.path.abspath(path)
for dir_name, sub_dirs, files in os.walk(path):
for filename in files:
abs_name = os.path.abspath(os.path.join(dir_name, filename))
file_name = abs_name[len(abs_path) + 1:]
zf.write(abs_name, file_name)
return bio.getvalue()
if __name__ == "__main__":
with open('test.zip', 'wb') as f:
f.write(zip_directory_into_bytes('.'))