Posts

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

Set up lampp on linux - ubantu

Step1 : Update && upgrade package sudo apt-get update && upgrade Step 2: install apache2  sudo apt install apache2 Step3: Adjust the firewall to allow web traffic sudo ufw app list If you look at the  Apache Full  profile, it should show that it enables traffic to ports  80  and  443 : sudo ufw app info "Apache Full" Step4: Set up your location suppose path is /home/gulshan/Projects && url will be http://projects then for this set up *Disable the old config* sudo a2dissite 000-default.conf *Create new config with name projects.conf* *Add this to them* <VirtualHost *:80>     ServerAdmin webmaster@projects     ServerName projects     ServerAlias projects     DocumentRoot /home/gulshan/Projects     <Directory /home/gulshan/Projects>          Options Indexes FollowSymLinks          AllowOverride all         ...