WSGI mod, Python, Django, Celery and a nice fella virtualenv

Here I’ll show how to use Python (3.8.0 in the current example, but legit for latest 3.+ versions, not for os.name == ‘NT’) and virtualenv to setup WGSI enabled website on Django (or any) with implemented Celery + Flower + RabbitMQ. This example is my own path used for automated test framework: Octopus (not available now, but have dev branch opened: Lobster) Here only configurations and setup for Python 3.8.0, virtualenv, WSGI, Django, Celery (worker and beat services), Flower and that’s it. Later I’ll show Django + Celery configuration when they run together (sort of). You may want to install Python at first: Read When your modern and fancy python is installed, we’ll make a virtual environment for our website.Short Read more…

Django + apache2 + mod_wsgi

This is conf file to allow apache run Django applications. # Web site at /var/www/smm_tools # Python scripts at /var/www/smm_tools/smm_py #LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so <VirtualHost *:80> ServerName smm.www.trianglesis.org.ua ServerAlias www.smm.www.trianglesis.org.ua ServerAdmin it@www.trianglesis.org.ua DocumentRoot /var/www/smm_tools/ ErrorLog “|/usr/sbin/rotatelogs /var/log/smm_tools/cargo.error.%Y-%m-%d.log 86400” CustomLog “|/usr/sbin/rotatelogs /var/log/smm_tools/cargo.access.%Y-%m-%d.log 86400” combined ServerSignature On Alias /css/ “/var/www/smm_tools/site/css” Alias /js/ “/var/www/smm_tools/site/js/” Alias /templates/ “var/www/smm_tools/site/templates/” Alias /fonts/ “/var/www/smm_tools/fonts/” #WSGIScriptAlias / /var/www/smm_tools/smm_tools.wsgi #WSGIPythonPath /var/www/smm_tools <Directory /var/www/smm_tools/smm_py/smm_py> <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess smm_tools python-path=/var/www/smm_tools/smm_py:/usr/local/lib/python3.4/site-packages/ WSGIProcessGroup smm_tools WSGIScriptAlias / /var/www/smm_tools/smm_py/smm_py/wsgi.py </VirtualHost> Use these links: https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04 https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ Don’t forget to use correct IPs – domains, and addresses. Especially if proxy pass is used.     Read more…