F.A.Q.

Q. Where are you from? I am from Patiala, Punjab.

Q. What is your Age? I am 20 years Old.

Q. Can you show all the basic Django Commands together?

// Creating Virtual Environment
    pip3 install virtualenv
    pip3 freeze
    virtualenv vnv

//Using Virtual Environment
    source ./vnv/bin/activate
    deactivate

// Installing Django
    pip3 install django

// Starting Django Project
    django -admin startproject [project_name]
    python manage.py runserver
    python manage.py migrate                   // migrate models
    python manage.py makemigrations
    python manage.py createsuperuser    // Creating a superuser account

    python manage.py startapp [appname]    // Creating a App

    pip3 freeze > requirements.txt

    pip3 install django cleanup         //add django_cleanup in settings in apps

    pip3 install -r requirements.txt  //use it when starting a project

Q. Can you show all the basic Docker Commands together?

docker login
docker ps  //show details of running container
docker ps -a // show deatials of all containers
docker run mongodb //pull and run the image
docker images // shows all the images available in pc
docker run -d container_id // run container in detached mode
docker stop container_id // stop the running container
docker start
docker run -p8000:80 image_name_id  // specifying ports here 8000 is new port and 80 is image port
docker logs container_id // shows logs of container
docker exec -it container_id /bin/bash // open the bash of a container
docker containers ls // show all the containers
docker container prune -f // delete all  the running and stopped containers
docker rm container_id // Remove a particular container
docker rmi image_id // Remove a particular image
docker build -t myimage //build the docker image
docker compose up --build // use docker-compose.yaml file
** How to push image on docker hub **
docker tag image-name username/image-name(repository name)
docker push tag
docker volume create volume_database
docker run -v volume_database :/data/db -p 27017:27017 mongo
docker volume ls
docker kill <volumeid/containerid>
docker volume rm volume_database
docker network create my_custom_network
docker network ls
docker run -p 3000:3000 --name name_to_image --network my_custom_network <image_tag> 
// convert the links like IP localhost to name_to_image and give names to those containers that need to connect to other containers or that provides data to other
docker run -v.:/usr/src/app <container_id>
// Using docker as a app
docker build . -t app:app_name
docker run app:dev
// Using Docker Compose
docker-compose up

Q. How to host django website on azure with docker?

// install azure cli
az login
az acr login --name name_of_container_registery_on_azure
docker tag image_name container_link/repo  // here repo is mainly container name e.g. docker tag resourcehub_image resourcehub12121.azurecr.io/container1
docker push resourcehub12121.azurecr.io/container1
// Now just create a container instance

Q. How to Create a Pull Request in a forked Repositoy

git clone https://github.com/<your-username>/<repo-name>  


cd <repo-name>  
git remote add upstream https://github.com/<upstream-owner>/<repo-name>
git remote -v # To the check the remotes for this repository 

git remote update
git checkout <branch-name>
git rebase upstream/<branch-name>

git branch
git checkout -b branch_name
git checkout -d branch_name

git add .  

git add <file name>

git commit -m "message"  

git push origin branch_name

**Q. What are main Basic GitHub Commands?

git clone <link>
git add <file_name/.> // . for all files
git status
git  commit -m " Any_comment"
git push origin main
git diff <path>

// How to Revert push
git reset --hard <Hex_code>
git push -f

// How to create Pull request
git branch
git checkout <name_of_other_branch>
git checkout -b <new_branch>
git branch -d <branch_to_delete>

Q. How to Install/Uninstall Kernel in Jupyter Notebook?

// installing Kernel
pip install ipykernel
python -m ipykernel install --user --name=my-python3-kernel
// Uninstalling Kernel
jupyter kernelspec list
jupyter kernelspec uninstall unwanted-kernel