Settings
A few settings are available which can be set through environment variables to control the APIs behavior.
SECRET_KEY
(Required)
Environment variable: SECRET_KEY
The secret key for the Django project. Django relies on this for many of its security features and it is recommended that you set it to a good value. A good tool for automatically generating a key is https://djecrety.ir/.
Example: zyx2w5@-l4kceqvu&*30vx-ikb&1d=h=q3vf9$2-rb$bhfp@88
STATIC_FOLDER
(Optional)
Environment variable: STATICFILES_DIR
Default: static
Relative path with respect to the project where collectstatic
should store the static files for use during deployment. This is used to build Django’s STATIC_ROOT
setting, by joining it with the BASE_DIR
setting.
Example: staticfiles
STATIC_URL
(Optional)
Environment variable: STATIC_URL
Default: /static/
URL to use when referring to static files stored in STATIC_ROOT
. See Django’s STATIC_URL
Example: http://static.example.com/
MEDIA_FOLDER
(Optional)
Environment variable: MEDIA_FOLDER
Default: media
Relative path with respect to the project where user-uploaded content such as documents and images should be stored. This is used to build Django’s MEDIA_ROOT
setting, by joining it with the BASE_DIR
setting.
Example: user_content
MEDIA_URL
(Optional)
Environment variable: MEDIA_URL
Default: /media/
URL to use when referring to user-uploaded content stored in MEDIA_ROOT
. See Django’s MEDIA_URL
.
Example: http://media.example.com/
MODEL_FOLDER
(Optional)
Environment variable: MODEL_FILE_ROOT
Default: ml_models
Relative path with respect to the project where the HDF5 of the uploaded models should be stored. This exists because it is better if the model files are stored separate from other user-uploaded content such as images.
Example: mesonet_variants
DATA_ROOT
(Optional)
Environment variable: DATA_ROOT
Default: data
Relative path with respect to MEDIA_ROOT
where the data to be used for prediction is stored. This is used to refer to the data folder easily inside the project. Specifically, this is used to build a absolute path to the directory, stored in DATA_DIRECTORY
. Inside your project, you can refer to the directory as:
from django.conf import settings
data = settings.DATA_DIRECTORY
Example: mesonet_variants