-
Notifications
You must be signed in to change notification settings - Fork 1
Flask API
Giovanni Garifo edited this page Nov 5, 2019
·
1 revision
- clone git repository inside
/var/www/, it's required to add credentials to the config.py file - install WSGI mod for apache2
sudo apt-get install libapache2-mod-wsgi python-dev - enable the installed mod with
a2enmod modname - Install pip python pkg manager:
sudo apt-get install python3-pip - install python pkgs required:
pip3 install Flask; pip3 install requests; - test if the app works:
python3 app.py - configure apache2 virtual host
geranium-api.conflike this:
<VirtualHost *:80>
ServerName api.geranium.org
ServerAdmin admin@localhost
WSGIScriptAlias / /var/www/geranium/process/geranium-api.wsgi
<Directory /home/geranium/geranium/process/>
Require all granted
</Directory>
Alias /static /var/www/geranium/process/static
<Directory /var/www/geranium/process/static/>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- add to
geranium-api.wsgi
root@geranium:/var/www/geranium/process# cat geranium-api.wsgi
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/geranium/process/")
from app import app as application
application.secret_key = b'biek9Va2aechie3Ljoh1Aisi'
-
git pullthe new version - add credentials to
config.py
Geranium Project