You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using encrypted_model_fields to encrypt a model field. The field I am encrypting is a password used to access a user account for another app via an api.
According to the docs I need to import the module and then wrap the model field as follows:
Models.py
from encrypted_model_fields.fields import EncryptedCharField
account_password = EncryptedCharField(models.CharField(max_length=20, blank=True))
In addition to that I need to add a FIELD_ENCRYPTION_KEY to settings.py, which I have done, as per the docs.
I have also added 'encrypted_model_fields' to installed apps in settings.py and the encryption key to .env, which is in place of the placeholder below..env:
If this does not help address your issues, it may be helpful to include what you have in your settings.py file, as well as in your models.py file where you are attempting to use encrypted fields.
I am using encrypted_model_fields to encrypt a model field. The field I am encrypting is a password used to access a user account for another app via an api.
According to the docs I need to import the module and then wrap the model field as follows:
Models.py
In addition to that I need to add a FIELD_ENCRYPTION_KEY to settings.py, which I have done, as per the docs.
Settings.py
FIELD_ENCRYPTION_KEY = os.environ.get('FIELD_ENCRYPTION_KEY')
I have also added 'encrypted_model_fields' to installed apps in settings.py and the encryption key to .env, which is in place of the placeholder below..env:
export FIELD_ENCRYPTION_KEY=my_encryption_key_place_holder
When I run makemigrations I receive the following error:
django.core.exceptions.ImproperlyConfigured: FIELD_ENCRYPTION_KEY must be defined in settings
I have defined it - so why is it not found?
The text was updated successfully, but these errors were encountered: