PyPY3 kurulumu için önceki konuyu takip edin.
https://makdos.blog/pypy/1003/ubuntu-pypy3-730-kurulumu-install-pypy3-730-ubuntu-1804/
templates klasör ve index.html dosyası
mkdir -p /var/www/html/templates/
nano /var/www/html/templates/index.html
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<title>Kurulum tamamlandı</title>
</head>
<body>
<h1>Flask is great!</h1>
</body>
</html>
pip3.6 install flask flask-sqlalchemy psycopg2cffi==2.8.1
nano flasktest.py
from flask import Flask
from flask import render_template
app = Flask(__name__)
try:
import psycopg2
except ImportError:
from psycopg2cffi import compat
compat.register()
@app.route('/')
def hello():
conn_string = \"host='localhost' dbname='testdb' user='root' password='root'\"
conn = psycopg2.connect(conn_string)
#return {'web':'inu'}
return render_template('index.html'), 200
if __name__ == '__main__':
app.run(debug=True)
nano flasktest.wsgi
import sys
sys.path.append('/var/www/html')
from flasktest import app as application
nano /etc/apache2/sites-enabled/000-default.conf
DocumentRoot '/var/www/html/'
WSGIDaemonProcess flasktest threads=5 python-path=/opt/pypy3/lib/sites-packages/:/var/www/html/
WSGIScriptAlias / /var/www/html/flasktest.wsgi
<Directory '/var/www/html'>
WSGIProcessGroup flasktest
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Order deny,allow
Allow from all
<Files flasktest.wsgi>
Require all granted
</Files>
</Directory>
ErrorLog '/var/www/html/error.log'
systemctl enable apache2 && systemctl start apache2
Kaynakça