I'm trying to deploy a simple hello world flask app on a linux server (Ubuntu 18.04.3). I'm logged into the linux box as bobtheuser. However, when I access the , I only see the contents "Index of/" listing the contents of /var/www/html/, i.e. the flask webapp isn't starting up.

flask app setup The app directory is setup like so:

├── __init__.py
├── my_flask_app.py
├── my_flask_app.wsgi


from flask import Flask

app = Flask(__name__)

def hello():
    return "Hello world! Hello Apache2 webserver!"

if __name__ == "__main__":


#!/usr/bin/env python3

import logging
import sys
sys.path.insert(0, '/var/www/html/helloflask/')
from my_flask_app import app as application
application.secret_key = 'helloflask-sk'


<VirtualHost *:80>
     # Add machine's IP address (use ifconfig command)
     # Give an alias to to start your website url with
     WSGIScriptAlias / /var/www/html/helloflask/my_flask_app.wsgi
     <Directory /var/www/html/helloflask>
     # set permissions as per apache2.conf file
            Options FollowSymLinks
            AllowOverride None
            Require all granted
     ErrorLog ${APACHE_LOG_DIR}/error.log
     LogLevel warn
     CustomLog ${APACHE_LOG_DIR}/access.log combined

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.