Posts

SSL by https://secure.ssl.com/

 SSL by https://secure.ssl.com/ 1. Create CSR from server 2. Copy CSR & PrivateKey Store them. //Private key Not use 3. Paste CSR in website 4. Download the certificate for Cpanel 5. In Webmin Go SSL>Apply Certificate Self-sign Paste CSR  & in private key Paste domain.crt file from downloaded. 6. In Certificate and Key Paste ca-bundle file 

Django with Mysql by mysqlclient

sudo apt-get install python3-dev libmysqlclient-dev python3 -m pip install mysqlclient virtualenv -p python3 env . env/bin/activate pip3 install django pip3 install mysqlclient OR Update it pip3 install -U mysqlclient django-admin startproject mysite .

Django with mysql By pyMYSQL

Work on less than 3.0.8 PyMySQL virtualenv -p python3 env . env/bin/activate         req.txt asgiref==3.2.10 Django==3.0.8 PyMySQL==0.10.0 python-decouple==3.3 pytz==2020.1 sqlparse==0.3.1        Database DATABASES = {     'default': {         'ENGINE': 'django.db.backends.mysql',         'NAME': 'dbname',         'USER': 'username',         'PASSWORD': 'password',         'HOST': '127.0.0.1',         'PORT': '3306',     } } Add this line in __init__.py import pymysql pymysql.install_as_MySQLdb()  

Django: Error: You don't have permission to access that port

Here my env: /home/user/test/env project: /home/user/test/mysite sudo sh -c ". $HOME/test/env/bin/activate && cd $HOME/test/ && python manage.py runserver --insecure 0.0.0.0:80"

Set up Django with apache

1. Create Project [ for project structure]         mkdir django_project         cd django_project          virtualenv env          source env/bin/activate          pip3 install django         // Set up static file & media file         // setting.py          //import os          //at the end of file         STATIC_ROOT = os.path.join(BASE_DIR, "static/")      // collect static file        python3 manage.py collectstatic 2. Create site for django         sudo nano /etc/apache2/sites-available/djangoproject.conf         //Add this in conf file with your domain and directory         <VirtualHost *:80>             ServerAdmin admin@djang...

Install Docker in ubuntu

1.  sudo apt-get update 2. sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common 3.  curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 4. sudo apt-key fingerprint 0EBFCD88 5. sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $( lsb_release -cs ) \ stable"

Install Django with Virtual Env

1. Update package & Install Python3 2. Install pip3           sudo apt install python3-pip 3. Install Virtual Env           sudo pip3 install virtualenv 4. Set up Environment           virtualenv -p python3 env_name 5. Activate Env         source env_name/bin/activate 6. Install Django           pip3 install djang           OR           pip3 install django==2.0.2 //For Specific version