Serving CSS for deployment on Apache2 server doesn't work

I’m trying to host a Dash app on a Apache2 server, but serving another CSS file I have placed under the assets folder is not working. This topic did not really help me fix that issue.

I have this structure basically:
And my directory structure is:

├── app.py
├── assets
│   └── bulma.css

which works with the css styles, when I run python app.py locally. On the server the app itself runs fine, but it’s not working to load the css file in assets.

My apache .conf file is

<VirtualHost *:80>
                ServerName <IP>
                ServerAdmin <MAIL>
                WSGIScriptAlias / /var/www/app/App.wsgi
                <Directory /var/www/app/>
                        Order allow,deny
                        Allow from all
                </Directory>
                ErrorLog ${APACHE_LOG_DIR}/App-error.log
                LogLevel warn
                CustomLog ${APACHE_LOG_DIR}/App-access.log combined
</VirtualHost>

My app.py is basically (aside from layout) this:

app = dash.Dash(external_stylesheets=external_stylesheets)
server = app.server
app.config.supress_callback_exceptions = True

My App.wsgi is:

 c#!/usr/bin/python3.6
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/app/")

from gd_analysis.app import server as application

Does anyone have an idea what I’m doing wrong or missing here?

When I want to use Apache to serve dash apps, I always use the command line mod_wsgi-express from the mod_wsgi package to run my app. You don’t need to faff around with config files or Apache process, just supply the flags you need, and it will spin up a new Apache process, with a bunch of good defaults tuned by someone who knows what they’re doing.

To serve up a Dash app as well as its static assets, I do something along the lines of the following:

$ mod_wsgi-express start-server \
        --application-type module \
        --entry-point your_app.wsgi \
        --port 8000 \
        --url-alias path_to_your_app_src/assets \
        --processes 4 \
        --compress-responses \
        --isatty \

Assuming you have installed a package your_app into your virtual environment and it has a module wsgi.py which imports the Flask server instance into an attribute application.

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online