Posts

SELINUX Notes

    selinux file vi /etc/selinux/config /sys/fs/selinux/enforce what is selinux? [root@localhost opt]# sestatus SELinux status:                 enabled SELinuxfs mount:                /sys/fs/selinux SELinux root directory:         /etc/selinux Loaded policy name:             targeted Current mode:                   enforcing Mode from config file:          enforcing Policy MLS status:              enabled Policy deny_unknown status:     allowed Memory protection checking:     actual (secure...

Django deploy static files

Image
 Description  Django needs to run the html, css and images from the static location that is part of our application Django.conf [root@localhost conf.d]# cat django.conf <VirtualHost *:80>     Alias /robots.txt /home/dj_adm/dj-practice/mysite/static/robots.txt     Alias /favicon.ico /home/dj_adm/dj-practice/mysite /static/favicon.ico     Alias /media/ /home/dj_adm/dj-practice/mysite/media/     Alias /static/ /home/dj_adm/dj-practice/mysite/static/     <Directory /home/dj_adm/dj-practice/mysite/static>         Require all granted     </Directory>     <Directory /home/dj_adm/dj-practice/mysite/media>         Require all granted     </Directory>     <Directory /home/dj_adm/dj-practice/mysite/mysite>     <files wsgi.py>    ...

Django admin server

Image
 Description We are creating the super user in django app. This will give us an elevated access in django app Django Admin (dj-env) [dj_adm@localhost mysite]$ python manage.py createsuperuser Username (leave blank to use 'dj_adm'): admin Email address: vel-----@gmail.com Password: Password (again): Superuser created successfully. (1045, "Access denied for user 'dj_adm'@'localhost' (using password: NO)")     We added the password directly to the settings.py and removed the dependency of my.cnf solved the problem possible other solutions ALTER USER 'dj_adm'@'localhost' IDENTIFIED WITH mysql_native_password BY '********';   FLUSH PRIVILEGES;  

Hello World in Django

Image
 Description  Hello world is the first program for all the tech Stacks. This article follows the django documentation 4.0 and added the flavors on top of it for better understanding.   Django flow for Hello World   Create the application "polls" start the app (dj-env) [dj_adm@localhost mysite]$ python manage.py startapp polls └── polls     ├── admin.py     ├── apps.py     ├── __init__.py     ├── migrations     │   └── __init__.py     ├── models.py     ├── tests.py     └── views.py In Views.py (dj-env) [dj_adm@localhost polls]$ cat views.py from django.shortcuts import render # Create your views here. from django.http import HttpResponse def index(request):     return HttpResponse("Hello, world. You're at the polls index.") In URLS.py (dj-env) [dj_adm@localhost polls]$ cat urls.py from django.urls import path from . impo...

Install mysql8 on centOS 9 and integrating with Django

Image
 Description Our application data (live or prod app) will be loaded into RDBMS(Mysql). So we are integrating mysql with django     Install mysql8 on centOS 9 This is available in the appSteam repo [root@localhost ~]# sudo dnf install mysql mysql-server -y Last metadata expiration check: 0:00:21 ago on Fri 08 Apr 2022 07:27:09 AM IST. Dependencies resolved. ===================================================================================================================================================================================================================  Package                                                        Architecture         ...