Update 'Quick Guide to publishing websites on hal.elte.hu with Python3 backend'

master
baskayj 4 years ago
parent
commit
fd91c27a39
  1. 19
      Quick-Guide-to-publishing-websites-on-hal.elte.hu-with-Python3-backend.md

19
Quick-Guide-to-publishing-websites-on-hal.elte.hu-with-Python3-backend.md

@ -24,7 +24,6 @@ Since Flask’s built-in server is not fit for live traffic, you need another WS
2. Install **mod_wsgi** compiled with python3: `SUDO APT-GET INSTALL LIBAPACHE2-MOD-WSGI-PY3`
3. Enable mod_wsgi: `SUDO A2ENMOD WSGI`
4. Create a config file for your website:
#### Creating `your_app.conf`
This file contains the paths to all the important Files needed for Apache2 to run your Python3 scripts. The minimal config file for a Flask-app, with static files (Images, CSS) present looks like:
```
@ -67,4 +66,20 @@ Replace `your_app` with the appropriate name of your website and folders. If you
> |-------------------------main.py
> |------------------------- (…)
7. ASD
7. Create a wsgi script, that can start your Python app in your virtualenv:
#### Creating `your_app.wsgi`
```
#!/var/www/html/your_app/your_app/venv/bin/python
import sys
import logging
import os
APP_HOME = "/var/www/html/your_app/your_app/"
sys.path.insert(0,"/var/www/html/your_app/your_app/venv/lib/python3.9/site-packages")
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,APP_HOME)
os.chdir(APP_HOME)
from main import app as application
```

Loading…
Cancel
Save