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

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

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

@ -11,12 +11,11 @@ It\'s also worth mentioning, that Flask has various \“AddOn\” modules, like
Once you’re done, collect all Python packages needed in a `requirements.txt` with version number included. It should look something like this:
```
1. Flask==2.0.2
2. Flask-WTF==1.0.0
3. .
4. .
5. .
Flask==2.0.2
Flask-WTF==1.0.0
.
.
.
```
# Configuring Apache2
@ -29,26 +28,26 @@ Since Flask’s built-in server is not fit for live traffic, you need another WS
## 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:
```
1. <VirtualHost *:80>
2. ServerAdmin username
3. DocumentRoot /var/www/html/your_app
4.
5. WSGIDaemonProcess your_app python-home=/var/www/html/your_app/your_app/venv python-path=/var/www/html/your_app/your_app:/var/www/html/your_app/your_app/venv/local/lib/python3.9/site-packages threads=5
6. WSGIScriptAlias /your_app /var/www/html/your_app/your_app.wsgi
7. WSGIApplicationGroup %{GLOBAL}
8. <Directory /var/www/html/your_app/your_app/>
9. WSGIProcessGroup your_app
10. WSGIApplicationGroup %{GLOBAL}
11. Order deny,allow
12. Allow from all
13. </Directory>
14. Alias /static /var/www/html/your_app/your_app/static
15. <Directory /var/www/html/your_app/your_app/static/>
16. Order allow,deny
17. Allow from all
18. </Directory>
19. ErrorLog ${APACHE_LOG_DIR}/error.log
20. LogLevel warn
21. CustomLog ${APACHE_LOG_DIR}/access.log combined
22. </VirtualHost>
<VirtualHost *:80>
ServerAdmin username
DocumentRoot /var/www/html/your_app
WSGIDaemonProcess your_app python-home=/var/www/html/your_app/your_app/venv python-path=/var/www/html/your_app/your_app:/var/www/html/your_app/your_app/venv/local/lib/python3.9/site-packages threads=5
WSGIScriptAlias /your_app /var/www/html/your_app/your_app.wsgi
WSGIApplicationGroup %{GLOBAL}
<Directory /var/www/html/your_app/your_app/>
WSGIProcessGroup your_app
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
Alias /static /var/www/html/your_app/your_app/static
<Directory /var/www/html/your_app/your_app/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
```

Loading…
Cancel
Save