update nvdcve set year = SUBSTRING(cve_id, 5,4) ;
Friday, October 2, 2020
Wednesday, September 16, 2020
Serve Django3 Applications with Apache2.4 and mod_wsgi on Ubuntu 20
Software versions: here are my application versions:
Python 3.8.2Django 3.1.1
Apache/2.4.41 (Ubuntu)
Installation:
Step 1: Install apache 2, Django and other packages
sudo apt-get install python3-pip
sudo pip3 install Django
sudo pip3 install mysql-python
Step 3: Create apache vhost file
cat /etc/apache2/sites-available/xxxx.com.conf
<VirtualHost *:80>
#My site Name
ServerName xxxx.com
DocumentRoot /var/www/myproject
WSGIDaemonProcess xxxx.com processes=2 threads=5 display-name=%{GROUP} python-path=/usr/local/lib/python3.8
#Pointing wsgi script to config file
WSGIScriptAlias / /var/www/myproject/myproject/wsgi.py
WSGIProcessGroup xxxx.com
#Your static files location
Alias /static/ "//var/www/myproject/static/"
<Location "/media">
SetHandler None
</Location>
<LocationMatch "\.(jpg|gif|png|js|css)$">
SetHandler None
</LocationMatch>
<Directory /var/www/myproject >
AllowOverride all
Require all granted
Options FollowSymlinks
</Directory>
</VirtualHost>
Step 4: modify this file /var/www/myproject/myproject/wsgi.py
cat /var/www/myproject/myproject/wsgi.py
import os
import time
import traceback
import signal
import sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/var/www/myproject')
sys.path.append('/usr/local/lib/python3.8/dist-packages')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'CVE.settings')
try:
application = get_wsgi_application()
except Exception:
# Error loading applications
if 'mod_wsgi' in sys.modules:
traceback.print_exc()
os.kill(os.getpid(), signal.SIGINT)
time.sleep(2.5)
Step 5: enable wsgi mod and enable site
-
Step 1, New a project rails new demo Step 2, Update Gemfile add paperclip, mysql2 gem, enable JavaScript runtime gem 'mysql2' ...
-
I used 7z to zip this file under Windows, try to unzip it under linux [ang@walker temp]$ gunzip 2011.sdf.zip gunzip: 2011.sdf.zip: unkno...
-
When trying to access transmission from web-browswer i got the message : 403: Forbidden Unauthorized IP Address. Either disable the IP ad...