Answer the question
In order to leave comments, you need to log in
Flask + Apache = Internal Server Error 500 when configured from the flask site. Where is the mistake?
I do everything like in this video https://www.youtube.com/watch?v=yMbiW45O_RA&t=13s , but the result is always one Internal Server Error. I looked through the documentation of the official flask site, everything matches there, I did the same work earlier on a virtual machine (now I work on the installed OS) - everything worked. I even found this machine and the necessary files. There is no difference in what I did then and what I am doing now, except for what worked then (and works, I checked), but not now.
I've been fiddling with this for a long time and can't figure out what's wrong. Help, here is the code:
init.py
activate_this_file = "/var/www/site/venv/bin/activate_this_file.py"
with open(activate_this_file) as _file:
exec(_file.read(), dict(__file__ = activate_this_file))
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
@app.route("/done")
def do():
return "RRRRRRR"
#!/usr/bin/env python
import sys
sys.path.insert(0, '/var/www/site/')
from init import app as application
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
#ServerAdmin [email protected]
#DocumentRoot /var/www/html
WSGIScriptAlias / /var/www/site/app.wsgi
<Directory /var/www/site>
Order allow,deny
Allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Answer the question
In order to leave comments, you need to log in
An error in the logs, of course.
PS When you do everything according to the video, but you get an error, you should think about the quality of the video.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question