Answer the question
In order to leave comments, you need to log in
How to create a flask app on centos7?
I apologize in advance for such a stupid question
. Here is the complete procedure.
1. Install Python, Flask, mod_wsgi
yum install python34 python34-devel python34-pip
pip3 install Flask
yum install mod_wsgi
#! usr/bin/python
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello1():
return "Hello World!"
if __name__ == "__main__":
app.run()
import sys
sys.path.insert(0, '/var/www/html/flask_dev')
from hello import app as application
<VirtualHost *80>
ServerName <адрес сервера>
WSGIScriptAlias / /var/www/html/flask_dev/hello.wsgi
WSGIScriptReloading On
<Directory /var/www/html/flask_dev>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
systemctl restart httpd
Index of /
Name Last modified Size Description
flask_dev/ 2018-01-28 01:14 -
Answer the question
In order to leave comments, you need to log in
1. sudo yum install epel-release
2. sudo yum install python-pip python-devel gcc nginx
3. sudo pip install virtualenv
4. mkdir ~/myproject
5. cd ~/myproject
6. virtualenv myprojectenv
7. source myprojectenv/bin/ activate
8. pip install gunicorn flask
9. vim ~/myproject/myproject.py
from flask import Flask
application = Flask(__name__)
@application.route("/")
def hello():
return "<h1 style='color:blue'>Hello There!</h1>"
if __name__ == "__main__":
application.run(host='0.0.0.0')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question