Open The-Judge opened 2 months ago
Thanks for the report, a number of people have reported similar issues across all backends and I'm simply unable to reproduce the issue. Do you have a minimal example?
Can you share a few things:
I just tried to reproduce this with the following steps:
az storage account create --name <some-unique-name> --resource-group <some-resource-group> --subscription <your-subscription-id> --public-network-access Enabled --allow-blob-public-access true
az storage account keys list --account-name <some-unique-name> --resource-group <some-resource-group> --subscription <your-subscription-id>
. Take note of any of those two values
.az storage container create --name static --subscription <your-subscription-id> --account-name <some-unique-name> --account-key '<key-from-step-2>' --public-access container
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[pipenv] allow_prereleases = false disable_pip_input = true
[packages] django = "~=5.0.4" whitenoise = {extras = ["brotli"], version = ""} gunicorn = "" dj_database_url = "" lz4 = "" django-storages = {extras = ["azure"], version = "*"}
[dev-packages]
[requires] python_version = "3.11"
6. Create Pipenv venv: `pipenv update --dev`
7. Activate venv: `source $(pipenv --venv)/bin/activate`
8. Start Django Project: `django-admin startproject demoproject`
9. In `settings.py`, add `"whitenoise.runserver_nostatic",` above `"django.contrib.staticfiles",` and `"storages",` below to `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"whitenoise.runserver_nostatic",
"django.contrib.staticfiles",
"storages",
]
settings.py
, add STORAGES
:
STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {
"BACKEND": "storages.backends.azure_storage.AzureStorage",
"OPTIONS": {
"account_name": 'MY_SA_NAME',
"azure_container": 'static',
"overwrite_files": True,
"account_key": 'MY_SA_KEY',
}
}
}
"Unfortunately", I couldn't; this, way everything seemed to work. I will try some more to find the reason this happens in my Wagtail based project.
Following the manual to use
django-storages
with Azure andstaticfiles
storage, I end up with this Django configuration:Running the manage.py task
collectstatic
works fine and stores the static files in the Azure Storage Account containerstatic
. When accessing the Page, this is the issue: