Skip to content

Instantly share code, notes, and snippets.

View nullx5's full-sized avatar
:octocat:
🎯 Keep Calm and Code in Python! 🐍

Blessed nullx5

:octocat:
🎯 Keep Calm and Code in Python! 🐍
View GitHub Profile
sudo a2enmod headers
sudo apachectl -M
sudo nvim /etc/apache2/conf-available/security.conf
Header always set X-Xss-Protection "1; mode=block"
Header always set X-Content-Type-Options: nosniff
Header always set X-Frame-Options "SAMEORIGIN"
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
https://vimawesome.com/
--------------------------------------------------
Plugin Manager VIM:
vim-plug*
----------------------------------------------
1# instalar neovim
sudo apt install neovim
2# archivos de configuracion
2.1# En debian la ruta es:
#############################################
EJECUTANDO CODIGO PYTHON DESDE APACHE CON CGI
#############################################
sudo a2enmod cgid
sudo a2enmod cgi
sudo a2query -m
sudo -Es nvim /usr/lib/cgi-bin/cgi.py
##################################################
sudo pip install mod-wsgi # Da error en Debian 11 y ubuntu 20.04
--------------------------------------------------
sudo apt install libapache2-mod-wsgi-py3 -y
sudo a2enmod wsgi
sudo a2query -m
mkdir django; cd django
sudo python3 -m venv env OR virtualenv env
###########################################################################
EJECUTANDO DJANGO DESDE APACHE CON uWSGI
---------------------------------------------------------------------------
Detrás de un servidor web completo
Aunque el enrutador HTTP uWSGI es sólido y de alto rendimiento, es posible que desee colocar su aplicación detrás de un servidor web totalmente capaz.
Para logs usar telnet al puerto 9191 o usar "uwsgitop"
##########################################################################
mkdir django; cd django
sudo python3 -m venv env OR virtualenv env
###########################################################################
EJECUTANDO DJANGO DESDE APACHE CON gunicorn
---------------------------------------------------------------------------
##########################################################################
mkdir django; cd django
sudo python3 -m venv env OR virtualenv env
source env/bin/activate
pip install django==2.2
###########################################################################
EJECUTANDO DJANGO DESDE NGINX CON gunicorn
---------------------------------------------------------------------------
##########################################################################
mkdir django; cd django
virtualenv env
source env/bin/activate
pip install django==2.2
pip install gunicorn
sudo apt update; sudo apt upgrade -y
sudo apt install apache2 mariadb-server php libapache2-mod-php php-mysql p7zip-full -y #php-cli
sudo mysql_secure_installation
root pass: admin123
sudo systemctl status apache2
sudo systemctl status mysql
####################################################
CONFIGURAR ARCHIVOS ESTATICOS DJANGO EN APACHE con mod-wsgi
####################################################
http://192.168.33.15/admin
cd django
sudo -Es nvim config/settings.py
DEBUG = False