'Failed running 'collectstatic' exited with exit code when deploying Django to Azure Web Service -

I am trying to deploy a Django app to Azure App Services. It runs on the server now, but without the style.css. When I run it on localhost, everything shows correctly with the style.css.

Here is my project structure:

voice-project -- app-- settings.py
                    -- wsgi.py
                    -- urls.py
                    -- manage.py
                    --db.sqlite3
                    -- asgi.py
             -- static
                 -- website
                    --style.css
             -- website
             -- .git

Below is my settings.py file:

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATIC_URL = 'static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]

Here is the collectstatic part from the deployment log:

11:23:09 PM voicify: Running collectstatic...
11:23:12 PM voicify: 130 static files copied to '/tmp/8da2d7d5197a819/staticfiles'.
11:23:12 PM voicify: "2022-05-03 07:00:00"|WARNING|Failed running 'collectstatic' exited with exit code .

I don't know where I can find what caused the running collectstatic error, and it seems not to provide an actual exit code.

In addition, if I move the static folder to somewhere else, such as under app, or under website, it gives me additional error messages, saying ?: (staticfiles.W004) The directory '/tmp/8da2d7971c62b0b/static' in the STATICFILES_DIRS setting does not exist.

I feel the only left for me to to is to add the static pattern to the url.pattern. But I feel this also won't solve the problem...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source