Skip to content

Instantly share code, notes, and snippets.

View devmahmud's full-sized avatar
🏠
Working From Home

Mahmudul Alam devmahmud

🏠
Working From Home
View GitHub Profile
@devmahmud
devmahmud / adding-to-user-admin-form.py
Created August 6, 2021 15:23 — forked from riklomas/adding-to-user-admin-form.py
How to add a field to the Django Admin Add User form using UserCreationForm. Add this to a admin.py and alter to whatever fields you'd like
# How to add a field to the Django Admin Add User form
# using UserCreationForm. Add this to a admin.py and alter
# to whatever fields you'd like
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
@devmahmud
devmahmud / passenger_wsgi.py
Created January 26, 2021 06:01
Run django web application in Linux Shared Hosting CPanel
import os
import sys
# pymysql is an alternative for mysqlclient
# import pymysql
# set variables
sys.path.append(os.getcwd())
os.environ['DJANGO_SETTINGS_MODULE'] = 'your_project_name.settings'
# setup django application
@devmahmud
devmahmud / generate-pem.md
Last active May 24, 2024 13:40
Generate pem file to login into remote server

We can use pem file to login into remote server from our local machines. Infact if you use AWS, the only way to SSH into the server is using pem file.

1. On your local Machine from where you require access, Home directory of the user is preferable

cd ~
ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):