保存到系统之前,如何使用“ Encrypted_FileField”对上传文件进行加密

时间:2019-05-15 12:49:30

标签: python-3.x windows django-models

  

我正在使用文件字段从用户获取文件,但是我想在加密后保存上载文件,为此,当我在成功安装django-encrypted-filefield软件包后导入cryptod_filefield时,服务器弹出错误:      LookupError:未安装标签为“ admin”的应用。   在安装应用程序中,我有“ django.contrib.admin”,我不知道该怎么办?请帮我。预先感谢。

setting.py

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'core',
]



models.py

from __future__ import unicode_literals
from django.db import models
from django-encrypted-filefield import encrypted_filefield                    
# got error when i import it otherwise running fine
from django.db import models
from django.core.validators import FileExtensionValidator
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.CharField(max_length=100)
description = models.CharField(max_length=100)
pdf = models.FileField(upload_to='books/pdfs/', validators= 
[FileExtensionValidator(allowed_extensions=['pdf'])])
cover = models.ImageField(upload_to='books/covers/', null=True, 
blank=True)
  

服务器上的实际错误:

File "C:\Users\AQEEL AHMAD\AppData\Local\Programs\Python\Python37-> 
32\lib\site-packages\django\apps\registry.py", line 162, in 
get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.

0 个答案:

没有答案