Azure - Django deployment Static Files

102 Views Asked by At

I try to deploy my django app to Azure App Services. I create App in Azure and deploy my app to Azure. But when i open app i can't see staticfiles (images). However I can see it in locally. By the wat I use sqlite for the database.

This is my settings.py file:

STATIC_URL = "/static/"
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images')


MEDIA_URL = '/images/'

STATICFILES_DIRS = [
    BASE_DIR / 'static'
]

# Deployment
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

And also this is urls.py file:

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# Deployment
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

First I fogot DEBUG=True, but I change it to DEBUG=False. It does not work also.

0

There are 0 best solutions below