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, Sublime Text 3 build system and developing process.

At first be sure that you are using this path to run pure apache: http://www.trianglesis.org.ua/django-python-3-4-wamp-apache-2-4-23-pycharm This topic for those who wants to develop ON THE FLY with python and django and do not want to manually restart dev server each time when code changes AND you don’t like built in python web-server and want to run your dev site as it should run on apache. Sublime Text 3 I use it for fast code changing and writting because PyCharm can’t work fine with multiline carrets, for example. Also PyCharm is too heavy when you want just copy&paste some features and see how it work on web. So my PyCharm will be used for debug purposes. I hope you know what isShort Read more…

Django + Python 3.4 + WAMP Apache 2.4.23 + Pycharm

Finally worked instance for hosting DEV site code on python and ability to resolve is as “on live” web server just on my laptop. A lot of different configurations changed but this is one working for me, and maybe can help you also. Better use EVERYTHING 32 bit for Window, you will suffer if you try to find some needed wheels for python 64bit on Windows 7 64bit.   WAMP Apache 2.4.23 Download: wampserver3.0.6_x86_apache2.4.23_mysql5.7.14_php5.6.25-7.0.10 Here NOTE: Install all needed C++ Redistr. packages which are listed in WAMP install guide! Download mod_wsgi.so Here or Here (for everythin 32 bit and python 3.4 on Win7 you need: mod_wsgi-py34-VC10.so) NOTE: Use mod_wsgi version which corresponds your python version! (Above in links you can find more info, justShort Read more…

Django static files

How to find where def. static stores? [root@test smm_py]# python3 manage.py findstatic css/base.css admin/js/core.js No matching file found for ‘css/base.css’. Found ‘admin/js/core.js’ here: /usr/local/lib/python3.4/site-packages/django/contrib/admin/static/admin/js/core.js Then move it into the folder you need. Then update django’s.conf file: Alias /static/ “/var/www/smm_tools/site/” And check the settings.py: 103 # Static files (CSS, JavaScript, Images) 104 # https://docs.djangoproject.com/en/1.8/howto/static-files/ 105 106 STATIC_URL = ‘/static/’ https://docs.djangoproject.com/en/1.8/howto/static-files/   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…

Allow Apache run python scripts

This is a simple ex. to allow apache run .py # Python site at /var/www/py_site LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so <VirtualHost *:80> ServerName test.www.trianglesis.org.ua ServerAlias www.www.trianglesis.org.ua ServerAdmin test@test.com DocumentRoot /var/www/py_site/ <Directory /var/www/py_site> Order allow,deny Require all granted Allow from all </Directory> <Directory /var/www/py_site/cgi-bin> Options +ExecCGI Require all granted Allow from all Options +ExecCGI AddHandler cgi-script .cgi .pl .py AddHandler cgi-script .py </Directory> </VirtualHost>     Read more…

addm 10 apache

Решил поставить себе триалку ADDM по работе, как водится прокинул проксю через вебсервер: И на тебе, половина линков дает ошибку 400: Bad Post Request 140512108713728 2015-01-20 10:22:18,684 ui.web.portal.SecurePage.AjaxKnowledgeManagementRequests WARNING Bad POST request to http://192.168.1.30/ui/AjaxKnowledgeManagementRequests from http://addm.www.trianglesis.org.ua/ui/DiscoveryKnowledgeManagement 140512203122432 2015-01-20 10:22:21,273 ui.web.portal.SecurePage.AjaxKnowledgeManagementRequests WARNING Bad POST request to http://192.168.1.30/ui/AjaxKnowledgeManagementRequests from http://addm.www.trianglesis.org.ua/ui/DiscoveryKnowledgeManagement 140512161163008 2015-01-20 10:22:27,441 ui.web.portal.SecurePage.DiscoveryKnowledgeManagement WARNING Bad POST request to http://192.168.1.30/ui/DiscoveryKnowledgeManagement from http://addm.www.trianglesis.org.ua/ui/DiscoveryKnowledgeManagement 140512192632576 2015-01-20 10:22:32,082 ui.web.portal.SecurePage.DiscoveryKnowledgeManagement WARNING Bad POST request to http://192.168.1.30/ui/DiscoveryKnowledgeManagement from http://addm.www.trianglesis.org.ua/ui/DiscoveryKnowledgeManagement 140512182142720 2015-01-20 13:49:33,335 ui.web.portal.SecurePage.DiscoveryKnowledgeManagement WARNING Bad POST request to http://192.168.1.30/ui/DiscoveryKnowledgeManagement from http://addm.www.trianglesis.org.ua/ui/DiscoveryKnowledgeManagement 140512108713728 2015-01-20 13:50:02,063 ui.web.portal.SecurePage.DiscoveryKnowledgeManagement WARNING Bad POST request to http://192.168.1.30/ui/DiscoveryKnowledgeManagement from http://addm.www.trianglesis.org.ua/ui/DiscoveryKnowledgeManagement   Кто мне скажет че это, что ни рыл, ничего толкового не смог найти.     Read more…

Как заставить Apache ранить Redmine

HowTo configure Apache to run Redmine Читаем официальный гайд, и далее я буду его разжовывать. 09/03/2014 В общем, бред это оказался, бред сумасшедшего. В итоге я просто скачал turnkey и все равно протрахался с ним двое суток, обновляя редмайн до последней версии. Всяко лучше, чем пилить этот проклятый апач – поверьте! Read more…

How to Serve Multiple Domains Using Virtual Hosts

Снова себе напоминалка себе, забыл про вирт. хосты. На мульти доменном сервере всегда нужно делать разводку по именам виртуальных хостов, вот код, чтобы не забыть: NameVirtualHost *:80 VirtualHost *:80 ServerName vh1.example.com DocumentRoot /var/www/vhosts/vh1 /VirtualHost VirtualHost *:80 ServerName vh2.example.com DocumentRoot /var/www/vhosts/vh2 /VirtualHost Источник: How to Serve Multiple Domains Using Virtual Hosts | Knowledge Center | Rackspace Hosting. Read more…