Flask app domain 404 Error

Posted February 1, 2016 8.1k views

I’ve been trying to setup my Flask app on DigitalOcean but keep getting a 404 error:

Not Found The requested URL / was not found on this server.
Apache/2.4.12 (Ubuntu) Server at Port 80

I’ve set up the site on Ubuntu 15.10 with apache2 and put my flask application in the /var/www/recomeal/Recomeal directory. I’ve been following this tutorial and don’t know what went wrong. I’ve also pointed my domain name ( at the virtual machine and I know that part at least is working, I just can’t get rid of the 404 error. Thanks so much for your help.


<VirtualHost *:80>
                WSGIScriptAlias / /var/www/recomeal/recomeal.wsgi
                <Directory /var/www/recomeal/Recomeal/>
                        Order allow,deny
                        Allow from all
                Alias /static /var/www/recomeal/Recomeal/static
                <Directory /var/www/recomeal/Recomeal/static/>
                        Order allow,deny
                        Allow from all
                ErrorLog ${APACHE_LOG_DIR}/error.log
                LogLevel warn
                CustomLog ${APACHE_LOG_DIR}/access.log combined


import sys
import logging

from Recomeal import app as application
application.secret_key = 'my key'

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Found the problem, I was using Python3 and wsgi was using Python2.

  • Hi Jack,

    I have the same problem as you. How did you change this?

    Did you just change the first line in your WSGI file to #!/usr/bin/python3 instead of #!/usr/bin/python ?